Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9696850683 | ||
|
a964ba95be | ||
|
d32b49c582 | ||
|
8e0b5ed685 | ||
|
9e309a9010 | ||
|
6331a42d12 | ||
|
83cfe50ae2 | ||
|
3dad2f76ad |
23
README.md
23
README.md
@ -1,5 +1,3 @@
|
|||||||
# 消极怠工中,相信你们可以自己写出更好用的!:)
|
|
||||||
|
|
||||||
# FZ生存数据包
|
# FZ生存数据包
|
||||||
|
|
||||||
为FZ服务器写的Minecraft生存辅助数据包
|
为FZ服务器写的Minecraft生存辅助数据包
|
||||||
@ -8,8 +6,6 @@
|
|||||||
|
|
||||||
#### Copyright (C) 2019-2022 Harvey_Husky
|
#### Copyright (C) 2019-2022 Harvey_Husky
|
||||||
|
|
||||||
[Bilibili专栏](https://www.bilibili.com/read/cv4267319)(年久失修)
|
|
||||||
|
|
||||||
## 安装教程
|
## 安装教程
|
||||||
|
|
||||||
1. 兼容性
|
1. 兼容性
|
||||||
@ -24,10 +20,9 @@
|
|||||||
6. (可选)从数据包 `zip` 文件的 `scripts` 目录中解压 `.sc` 文件,将其放入 `world/scripts` 中(在客户端位于 `.minecraft/saves/<存档名>/scripts` )
|
6. (可选)从数据包 `zip` 文件的 `scripts` 目录中解压 `.sc` 文件,将其放入 `world/scripts` 中(在客户端位于 `.minecraft/saves/<存档名>/scripts` )
|
||||||
7. 执行 `reload` 指令(或重新打开存档;在一些第三方服务端中可能需要改为`/minecraft:reload`)
|
7. 执行 `reload` 指令(或重新打开存档;在一些第三方服务端中可能需要改为`/minecraft:reload`)
|
||||||
|
|
||||||
|
|
||||||
# FZ生存数据包 3.0
|
# FZ生存数据包 3.0
|
||||||
|
|
||||||
[![数据包版本](https://img.shields.io/badge/正式版-3.0.5-blue.svg)](https://gitee.com/harvey-husky/FZ-sDatapack/releases) [![MC版本](https://img.shields.io/badge/Minecraft-1.19+-blue.svg)](https://minecraft.net/)
|
[![数据包版本](https://img.shields.io/badge/正式版-3.0.10-blue.svg)](https://gitee.com/harvey-husky/FZ-sDatapack/releases) [![MC版本](https://img.shields.io/badge/Minecraft-1.19+-blue.svg)](https://minecraft.net/)
|
||||||
|
|
||||||
> 其他版本见[发行页面](https://gitee.com/harvey-husky/FZ-sDatapack/releases)
|
> 其他版本见[发行页面](https://gitee.com/harvey-husky/FZ-sDatapack/releases)
|
||||||
|
|
||||||
@ -61,6 +56,21 @@
|
|||||||
| :------: | :----------------------------------------------: |
|
| :------: | :----------------------------------------------: |
|
||||||
| 破基岩榜 |fzsd.module.scoreboard.display.bedrock_broken_count|
|
| 破基岩榜 |fzsd.module.scoreboard.display.bedrock_broken_count|
|
||||||
|
|
||||||
|
- 系统总榜计分板:`fzsd.module.scoreboard.assign.general`
|
||||||
|
- 可以在在此记分板修改总分数据,下次加分时会刷新显示分数
|
||||||
|
- 总计分项名称对照表:
|
||||||
|
|
||||||
|
| 默认名称 | 计分板ID |
|
||||||
|
| :------: | :----------------------------------------------: |
|
||||||
|
| 总活跃时间 | fzsd.module.scoreboard.total.activation |
|
||||||
|
| 总飞行距离 | fzsd.module.scoreboard.total.aviating_distance |
|
||||||
|
| 总受伤害量 | fzsd.module.scoreboard.total.damage_taken |
|
||||||
|
| 总死亡数 | fzsd.module.scoreboard.total.death_count |
|
||||||
|
| 总挖掘量 | fzsd.module.scoreboard.total.dig_count |
|
||||||
|
| 总钓鱼数 | fzsd.module.scoreboard.total.fishing_count |
|
||||||
|
| 总击杀数 | fzsd.module.scoreboard.total.kill_count |
|
||||||
|
| 总放置方块数 | fzsd.module.scoreboard.total.placement_count |
|
||||||
|
| 总交易量 | fzsd.module.scoreboard.total.trade_count |
|
||||||
|
|
||||||
### 地毯脚本
|
### 地毯脚本
|
||||||
|
|
||||||
@ -95,4 +105,5 @@
|
|||||||
- 见游戏内交互器按钮
|
- 见游戏内交互器按钮
|
||||||
|
|
||||||
## 开发者相关
|
## 开发者相关
|
||||||
|
|
||||||
- 参见[开发文档](/DEVDOC.md)
|
- 参见[开发文档](/DEVDOC.md)
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"replace": false,
|
"replace": false,
|
||||||
"values": [
|
"values": [
|
||||||
"fzsd.extra.bbl:display/set_text/black"
|
"fzsd.extra.bbl:display/set_text/dark_gray"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
execute store success storage fzsd:version fzsd.need_update int 1 run data merge storage fzsd:version {fzsd: {version: '3.0.7'}}
|
execute store success storage fzsd:version fzsd.need_update int 1 run data merge storage fzsd:version {fzsd: {version: '3.0.10'}}
|
||||||
execute if data storage fzsd:version fzsd{need_update: 1} run function fzsd:system/update
|
execute if data storage fzsd:version fzsd{need_update: 1} run function fzsd:system/update
|
||||||
function fzsd:system/carpet/try_load_fzsd_score
|
function fzsd:system/carpet/try_load_fzsd_score
|
||||||
function #fzsd:load
|
function #fzsd:load
|
||||||
|
@ -1 +1 @@
|
|||||||
tellraw @a [{"text": ""}, [{"selector": "@s"}, {"text": "说:我在", "color": "white"}, {"nbt": "fzsd.dimension.name", "interpret": true, "storage": "fzsd:here"}, [{"text": " [", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:here"}, {"text": "]"}], {"nbt": "fzsd.message.append", "interpret": true, "storage": "fzsd:here"}]]
|
tellraw @a [{"text": ""}, [{"selector": "@s"}, {"text": "说:我在", "color": "white"}, {"nbt": "fzsd.dimension.name", "interpret": true, "storage": "fzsd:here"}, [{"text": "[", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:here"}, {"text": "]"}], {"nbt": "fzsd.message.append", "interpret": true, "storage": "fzsd:here"}]]
|
@ -1 +1 @@
|
|||||||
tellraw @s [{"text": "你在", "color": "white"}, {"nbt": "fzsd.dimension.name", "interpret": true, "storage": "fzsd:here"}, [{"text": " [", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:here"}, {"text": "]"}], {"nbt": "fzsd.message.append", "interpret": true, "storage": "fzsd:here"}]
|
tellraw @s [{"text": "你在", "color": "white"}, {"nbt": "fzsd.dimension.name", "interpret": true, "storage": "fzsd:here"}, [{"text": "[", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:here"}, {"text": "]"}], {"nbt": "fzsd.message.append", "interpret": true, "storage": "fzsd:here"}]
|
@ -1,2 +1,4 @@
|
|||||||
scoreboard players add @s fzsd.module.scoreboard.display.activation 1
|
scoreboard players add @s fzsd.module.scoreboard.display.activation 1
|
||||||
|
execute if score @s fzsd.module.scoreboard.display.activation matches ..-1 run scoreboard players set @s fzsd.module.scoreboard.display.activation 2147483647
|
||||||
scoreboard players add fzsd.module.scoreboard.total.activation fzsd.module.scoreboard.assign.general 1
|
scoreboard players add fzsd.module.scoreboard.total.activation fzsd.module.scoreboard.assign.general 1
|
||||||
|
execute if score fzsd.module.scoreboard.total.activation fzsd.module.scoreboard.assign.general matches ..-1 run scoreboard players set fzsd.module.scoreboard.total.activation fzsd.module.scoreboard.assign.general 2147483647
|
@ -1,2 +1,4 @@
|
|||||||
scoreboard players operation @s fzsd.module.scoreboard.display.aviating_distance += fzsd.var.score fzsd.variable.integer
|
scoreboard players operation @s fzsd.module.scoreboard.display.aviating_distance += fzsd.var.score fzsd.variable.integer
|
||||||
|
execute if score @s fzsd.module.scoreboard.display.aviating_distance matches ..-1 run scoreboard players set @s fzsd.module.scoreboard.display.aviating_distance 2147483647
|
||||||
scoreboard players operation fzsd.module.scoreboard.total.aviating_distance fzsd.module.scoreboard.assign.general += fzsd.var.score fzsd.variable.integer
|
scoreboard players operation fzsd.module.scoreboard.total.aviating_distance fzsd.module.scoreboard.assign.general += fzsd.var.score fzsd.variable.integer
|
||||||
|
execute if score fzsd.module.scoreboard.total.aviating_distance fzsd.module.scoreboard.assign.general matches ..-1 run scoreboard players set fzsd.module.scoreboard.total.aviating_distance fzsd.module.scoreboard.assign.general 2147483647
|
@ -1,2 +1,4 @@
|
|||||||
scoreboard players operation @s fzsd.module.scoreboard.display.damage_taken += fzsd.var.score fzsd.variable.integer
|
scoreboard players operation @s fzsd.module.scoreboard.display.damage_taken += fzsd.var.score fzsd.variable.integer
|
||||||
|
execute if score @s fzsd.module.scoreboard.display.damage_taken matches ..-1 run scoreboard players set @s fzsd.module.scoreboard.display.damage_taken 2147483647
|
||||||
scoreboard players operation fzsd.module.scoreboard.total.damage_taken fzsd.module.scoreboard.assign.general += fzsd.var.score fzsd.variable.integer
|
scoreboard players operation fzsd.module.scoreboard.total.damage_taken fzsd.module.scoreboard.assign.general += fzsd.var.score fzsd.variable.integer
|
||||||
|
execute if score fzsd.module.scoreboard.total.damage_taken fzsd.module.scoreboard.assign.general matches ..-1 run scoreboard players set fzsd.module.scoreboard.total.damage_taken fzsd.module.scoreboard.assign.general 2147483647
|
@ -1,2 +1,4 @@
|
|||||||
scoreboard players add @s fzsd.module.scoreboard.display.death_count 1
|
scoreboard players add @s fzsd.module.scoreboard.display.death_count 1
|
||||||
|
execute if score @s fzsd.module.scoreboard.display.death_count matches ..-1 run scoreboard players set @s fzsd.module.scoreboard.display.death_count 2147483647
|
||||||
scoreboard players add fzsd.module.scoreboard.total.death_count fzsd.module.scoreboard.assign.general 1
|
scoreboard players add fzsd.module.scoreboard.total.death_count fzsd.module.scoreboard.assign.general 1
|
||||||
|
execute if score fzsd.module.scoreboard.total.death_count fzsd.module.scoreboard.assign.general matches ..-1 run scoreboard players set fzsd.module.scoreboard.total.death_count fzsd.module.scoreboard.assign.general 2147483647
|
@ -1,2 +1,4 @@
|
|||||||
scoreboard players operation @s fzsd.module.scoreboard.display.dig_count += fzsd.var.score fzsd.variable.integer
|
scoreboard players operation @s fzsd.module.scoreboard.display.dig_count += fzsd.var.score fzsd.variable.integer
|
||||||
|
execute if score @s fzsd.module.scoreboard.display.dig_count matches ..-1 run scoreboard players set @s fzsd.module.scoreboard.display.dig_count 2147483647
|
||||||
scoreboard players operation fzsd.module.scoreboard.total.dig_count fzsd.module.scoreboard.assign.general += fzsd.var.score fzsd.variable.integer
|
scoreboard players operation fzsd.module.scoreboard.total.dig_count fzsd.module.scoreboard.assign.general += fzsd.var.score fzsd.variable.integer
|
||||||
|
execute if score fzsd.module.scoreboard.total.dig_count fzsd.module.scoreboard.assign.general matches ..-1 run scoreboard players set fzsd.module.scoreboard.total.dig_count fzsd.module.scoreboard.assign.general 2147483647
|
@ -1,2 +1,4 @@
|
|||||||
scoreboard players add @s fzsd.module.scoreboard.display.fishing_count 1
|
scoreboard players add @s fzsd.module.scoreboard.display.fishing_count 1
|
||||||
|
execute if score @s fzsd.module.scoreboard.display.fishing_count matches ..-1 run scoreboard players set @s fzsd.module.scoreboard.display.fishing_count 2147483647
|
||||||
scoreboard players add fzsd.module.scoreboard.total.fishing_count fzsd.module.scoreboard.assign.general 1
|
scoreboard players add fzsd.module.scoreboard.total.fishing_count fzsd.module.scoreboard.assign.general 1
|
||||||
|
execute if score fzsd.module.scoreboard.total.fishing_count fzsd.module.scoreboard.assign.general matches ..-1 run scoreboard players set fzsd.module.scoreboard.total.fishing_count fzsd.module.scoreboard.assign.general 2147483647
|
@ -1,2 +1,4 @@
|
|||||||
scoreboard players add @s fzsd.module.scoreboard.display.kill_count 1
|
scoreboard players add @s fzsd.module.scoreboard.display.kill_count 1
|
||||||
|
execute if score @s fzsd.module.scoreboard.display.kill_count matches ..-1 run scoreboard players set @s fzsd.module.scoreboard.display.kill_count 2147483647
|
||||||
scoreboard players add fzsd.module.scoreboard.total.kill_count fzsd.module.scoreboard.assign.general 1
|
scoreboard players add fzsd.module.scoreboard.total.kill_count fzsd.module.scoreboard.assign.general 1
|
||||||
|
execute if score fzsd.module.scoreboard.total.kill_count fzsd.module.scoreboard.assign.general matches ..-1 run scoreboard players set fzsd.module.scoreboard.total.kill_count fzsd.module.scoreboard.assign.general 2147483647
|
@ -1,2 +1,4 @@
|
|||||||
scoreboard players add @s fzsd.module.scoreboard.display.placement_count 1
|
scoreboard players add @s fzsd.module.scoreboard.display.placement_count 1
|
||||||
|
execute if score @s fzsd.module.scoreboard.display.placement_count matches ..-1 run scoreboard players set @s fzsd.module.scoreboard.display.placement_count 2147483647
|
||||||
scoreboard players add fzsd.module.scoreboard.total.placement_count fzsd.module.scoreboard.assign.general 1
|
scoreboard players add fzsd.module.scoreboard.total.placement_count fzsd.module.scoreboard.assign.general 1
|
||||||
|
execute if score fzsd.module.scoreboard.total.placement_count fzsd.module.scoreboard.assign.general matches ..-1 run scoreboard players set fzsd.module.scoreboard.total.placement_count fzsd.module.scoreboard.assign.general 2147483647
|
@ -1,2 +1,4 @@
|
|||||||
scoreboard players add @s fzsd.module.scoreboard.display.trade_count 1
|
scoreboard players add @s fzsd.module.scoreboard.display.trade_count 1
|
||||||
|
execute if score @s fzsd.module.scoreboard.display.trade_count matches ..-1 run scoreboard players set @s fzsd.module.scoreboard.display.trade_count 2147483647
|
||||||
scoreboard players add fzsd.module.scoreboard.total.trade_count fzsd.module.scoreboard.assign.general 1
|
scoreboard players add fzsd.module.scoreboard.total.trade_count fzsd.module.scoreboard.assign.general 1
|
||||||
|
execute if score fzsd.module.scoreboard.total.trade_count fzsd.module.scoreboard.assign.general matches ..-1 run scoreboard players set fzsd.module.scoreboard.total.trade_count fzsd.module.scoreboard.assign.general 2147483647
|
@ -1,7 +1,82 @@
|
|||||||
{
|
{
|
||||||
"condition": "minecraft:entity_properties",
|
"condition": "minecraft:alternative",
|
||||||
"entity": "this",
|
"terms": [
|
||||||
"predicate": {
|
{
|
||||||
"nbt": "{Item:{id:\"minecraft:minecart\"}}"
|
"condition": "minecraft:entity_properties",
|
||||||
}
|
"entity": "this",
|
||||||
|
"predicate": {
|
||||||
|
"nbt": "{Item:{id:\"minecraft:minecart\"}}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"condition": "minecraft:entity_properties",
|
||||||
|
"entity": "this",
|
||||||
|
"predicate": {
|
||||||
|
"nbt": "{Item:{id:\"minecraft:hopper_minecart\"}}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"condition": "minecraft:entity_properties",
|
||||||
|
"entity": "this",
|
||||||
|
"predicate": {
|
||||||
|
"nbt": "{Item:{id:\"minecraft:chest_minecart\"}}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"condition": "minecraft:entity_properties",
|
||||||
|
"entity": "this",
|
||||||
|
"predicate": {
|
||||||
|
"nbt": "{Item:{id:\"minecraft:furnace_minecart\"}}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"condition": "minecraft:entity_properties",
|
||||||
|
"entity": "this",
|
||||||
|
"predicate": {
|
||||||
|
"nbt": "{Item:{id:\"minecraft:oak_boat\"}}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"condition": "minecraft:entity_properties",
|
||||||
|
"entity": "this",
|
||||||
|
"predicate": {
|
||||||
|
"nbt": "{Item:{id:\"minecraft:birch_boat\"}}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"condition": "minecraft:entity_properties",
|
||||||
|
"entity": "this",
|
||||||
|
"predicate": {
|
||||||
|
"nbt": "{Item:{id:\"minecraft:acacia_boat\"}}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"condition": "minecraft:entity_properties",
|
||||||
|
"entity": "this",
|
||||||
|
"predicate": {
|
||||||
|
"nbt": "{Item:{id:\"minecraft:jungle_boat\"}}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"condition": "minecraft:entity_properties",
|
||||||
|
"entity": "this",
|
||||||
|
"predicate": {
|
||||||
|
"nbt": "{Item:{id:\"minecraft:spruce_boat\"}}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"condition": "minecraft:entity_properties",
|
||||||
|
"entity": "this",
|
||||||
|
"predicate": {
|
||||||
|
"nbt": "{Item:{id:\"minecraft:dark_oak_boat\"}}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"condition": "minecraft:entity_properties",
|
||||||
|
"entity": "this",
|
||||||
|
"predicate": {
|
||||||
|
"nbt": "{Item:{id:\"minecraft:mangrove_boat\"}}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"replace": false,
|
|
||||||
"values": [
|
|
||||||
"fzsd:module/join_message/default_message"
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"replace": false,
|
"replace": false,
|
||||||
"values": [
|
"values": [
|
||||||
"#fzsd:module/join_message/default_message"
|
"fzsd:module/join_message/default_message"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -19,41 +19,11 @@ require_not_null(value) -> (
|
|||||||
);
|
);
|
||||||
|
|
||||||
require_version(requirement) -> (
|
require_version(requirement) -> (
|
||||||
req_0 = slice(requirement, 0, 1);
|
req_ver = split('\\.', requirement);
|
||||||
req_1 = slice(requirement, 1, 2);
|
cur_ver = split('\\.', global_carpet_version);
|
||||||
if(req_0 == '>',
|
return(number(cur_ver:0) >= number(req_ver:0)
|
||||||
if(req_1 == '=',
|
&& number(cur_ver:1) >= number(req_ver:1)
|
||||||
req_ver = split('>=|\\.', requirement);
|
&& number(cur_ver:2) >= number(req_ver:2));
|
||||||
print(player('all'), req_ver);
|
|
||||||
cur_ver = split('\\.', global_carpet_version);
|
|
||||||
return(number(req_ver:1) >= number(cur_ver:0)
|
|
||||||
&& number(req_ver:2) >= number(cur_ver:1)
|
|
||||||
&& number(req_ver:3) >= number(cur_ver:2));
|
|
||||||
);
|
|
||||||
req_ver = split('>|\\.', requirement);
|
|
||||||
print(player('all'), req_ver);
|
|
||||||
cur_ver = split('\\.', global_carpet_version);
|
|
||||||
return(number(req_ver:1) > number(cur_ver:0)
|
|
||||||
&& number(req_ver:2) > number(cur_ver:1)
|
|
||||||
&& number(req_ver:3) > number(cur_ver:2));
|
|
||||||
);
|
|
||||||
if(req_0 == '<',
|
|
||||||
if(req_1 == '=',
|
|
||||||
req_ver = split('<=|\\.', requirement);
|
|
||||||
print(player('all'), req_ver);
|
|
||||||
cur_ver = split('\\.', global_carpet_version);
|
|
||||||
return(number(req_ver:1) <= number(cur_ver:0)
|
|
||||||
&& number(req_ver:2) <= number(cur_ver:1)
|
|
||||||
&& number(req_ver:3) <= number(cur_ver:2));
|
|
||||||
);
|
|
||||||
req_ver = split('<|\\.', requirement);
|
|
||||||
print(player('all'), req_ver);
|
|
||||||
cur_ver = split('\\.', global_carpet_version);
|
|
||||||
return(number(req_ver:1) < number(cur_ver:0)
|
|
||||||
&& number(req_ver:2) < number(cur_ver:1)
|
|
||||||
&& number(req_ver:3) < number(cur_ver:2));
|
|
||||||
);
|
|
||||||
return(false);
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//** 主要逻辑 **//
|
//** 主要逻辑 **//
|
||||||
@ -145,22 +115,7 @@ __config() -> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
__on_start() -> (
|
__on_start() -> (
|
||||||
// 读取配置文件
|
reload_configs();
|
||||||
global_config = read_file('config', 'json');
|
|
||||||
if(global_config == null, // carpet 1.4.69 兼容
|
|
||||||
global_config = {};
|
|
||||||
);
|
|
||||||
if(length(global_config) == 0, // 读取失败或不存在
|
|
||||||
delete_file('config', 'json'); // 避免一些意外的问题
|
|
||||||
global_config:'config_version' = '1.0.0'; // 占位用,无实际作用
|
|
||||||
if(require_version('>=1.99.99'), // 等待新功能支持
|
|
||||||
global_config:'allow_spawn_whitelist_player' = false;
|
|
||||||
write_file('config', 'json', global_config);
|
|
||||||
,
|
|
||||||
// else
|
|
||||||
write_file('config', 'json', global_config);
|
|
||||||
);
|
|
||||||
);
|
|
||||||
global_team_cache = read_file('team_cache', 'json');
|
global_team_cache = read_file('team_cache', 'json');
|
||||||
if(global_team_cache == null, // carpet 1.4.69 兼容
|
if(global_team_cache == null, // carpet 1.4.69 兼容
|
||||||
global_team_cache = {};
|
global_team_cache = {};
|
||||||
@ -173,12 +128,14 @@ __on_close() -> (
|
|||||||
write_file('team_cache', 'json', global_team_cache);
|
write_file('team_cache', 'json', global_team_cache);
|
||||||
);
|
);
|
||||||
|
|
||||||
if(require_version('>=1.99.99'), // 等待新功能支持
|
if(require_version('1.4.112'), // 新功能支持
|
||||||
__on_player_command(player, message) -> (
|
__on_player_command(player, command) -> (
|
||||||
print(player('all'), 'command!');
|
l = length(command);
|
||||||
if(length(message) > 7
|
if(l > 13
|
||||||
&& slice(message, 0, 7) == '/player'
|
&& slice(command, 0, 6) == 'player'
|
||||||
&& !(global_config:'allow_spawn_whitelist_player'),
|
&& slice(command, l - 5, l) == 'spawn'
|
||||||
|
&& !(global_config:'allow_spawn_whitelist_player')
|
||||||
|
&& contains(get_server_whitelist(), slice(command, 7, l - 6)),
|
||||||
return('cancel');
|
return('cancel');
|
||||||
);
|
);
|
||||||
);
|
);
|
||||||
@ -186,11 +143,11 @@ if(require_version('>=1.99.99'), // 等待新功能支持
|
|||||||
|
|
||||||
__on_player_connects(player) -> (
|
__on_player_connects(player) -> (
|
||||||
player_type = player ~ 'player_type';
|
player_type = player ~ 'player_type';
|
||||||
player_team = player ~ 'team';
|
|
||||||
player_name = player ~ 'name';
|
|
||||||
if(player_type == 'fake',
|
if(player_type == 'fake',
|
||||||
(
|
(
|
||||||
|
player_team = player ~ 'team';
|
||||||
if(player_team != 'fzsd.module.scoreboard.fake',
|
if(player_team != 'fzsd.module.scoreboard.fake',
|
||||||
|
player_name = player ~ 'name';
|
||||||
global_team_cache:player_name = player_team;
|
global_team_cache:player_name = player_team;
|
||||||
);
|
);
|
||||||
team_add('fzsd.module.scoreboard.fake', player);
|
team_add('fzsd.module.scoreboard.fake', player);
|
||||||
@ -198,7 +155,9 @@ __on_player_connects(player) -> (
|
|||||||
),
|
),
|
||||||
player_type == 'shadow',
|
player_type == 'shadow',
|
||||||
(
|
(
|
||||||
|
player_team = player ~ 'team';
|
||||||
if(player_team != 'fzsd.module.scoreboard.shadow',
|
if(player_team != 'fzsd.module.scoreboard.shadow',
|
||||||
|
player_name = player ~ 'name';
|
||||||
global_team_cache:player_name = player_team;
|
global_team_cache:player_name = player_team;
|
||||||
);
|
);
|
||||||
team_add('fzsd.module.scoreboard.shadow', player);
|
team_add('fzsd.module.scoreboard.shadow', player);
|
||||||
@ -222,6 +181,35 @@ __on_player_disconnects(player, reason) -> (
|
|||||||
try_restore_team_from_cache(player);
|
try_restore_team_from_cache(player);
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 获取服务器白名单
|
||||||
|
get_server_whitelist() -> (
|
||||||
|
return(keys(system_info('server_whitelist')));
|
||||||
|
);
|
||||||
|
|
||||||
|
// 重载配置文件
|
||||||
|
reload_configs() -> (
|
||||||
|
// 读取配置文件
|
||||||
|
global_config = read_file('config', 'json');
|
||||||
|
if(global_config == null, // carpet 1.4.69 兼容
|
||||||
|
global_config = {};
|
||||||
|
);
|
||||||
|
config_changed = false;
|
||||||
|
// 读取失败或不存在
|
||||||
|
if(length(global_config) == 0,
|
||||||
|
global_config:'config_version' = '1.0.0'; // 占位用,无实际作用
|
||||||
|
config_changed = true;
|
||||||
|
);
|
||||||
|
// 新功能支持
|
||||||
|
if(require_version('1.4.112') && !contains(global_config, 'allow_spawn_whitelist_player'),
|
||||||
|
global_config:'allow_spawn_whitelist_player' = false;
|
||||||
|
config_changed = true;
|
||||||
|
);
|
||||||
|
if(config_changed == true,
|
||||||
|
delete_file('config', 'json'); // 避免一些意外的问题
|
||||||
|
write_file('config', 'json', global_config);
|
||||||
|
);
|
||||||
|
);
|
||||||
|
|
||||||
// 获取所有计分板下的所有玩家列表
|
// 获取所有计分板下的所有玩家列表
|
||||||
get_scoreboard_player_list() -> (
|
get_scoreboard_player_list() -> (
|
||||||
set = m();
|
set = m();
|
||||||
@ -395,20 +383,14 @@ merge_score(from, to, fzsd_version) -> (
|
|||||||
// 获取承载总榜数据的玩家名
|
// 获取承载总榜数据的玩家名
|
||||||
// 因为新计分板允许玩家自定义显示的总榜名称,故做复杂判断才能使脚本确定用来承载总榜数据的玩家名
|
// 因为新计分板允许玩家自定义显示的总榜名称,故做复杂判断才能使脚本确定用来承载总榜数据的玩家名
|
||||||
get_total_score_name_new(scoreboard) -> (
|
get_total_score_name_new(scoreboard) -> (
|
||||||
INT_MIN = -2147483648;
|
// 系统总榜id
|
||||||
// 获取系统总榜id
|
sys_total_name = replace(scoreboard, 'display', 'total');
|
||||||
system_total_name = replace(scoreboard, 'display', 'total');
|
|
||||||
|
|
||||||
|
// 当前总分
|
||||||
|
current_score = scoreboard('fzsd.module.scoreboard.assign.general', sys_total_name);
|
||||||
|
|
||||||
// 将系统总榜分数加上最小int值,使其成为最低分
|
// 将系统总榜分数设为INT_MIN,使其成为最低分
|
||||||
scoreboard(
|
scoreboard('fzsd.module.scoreboard.assign.general', sys_total_name, -2147483648);
|
||||||
'fzsd.module.scoreboard.assign.general',
|
|
||||||
system_total_name,
|
|
||||||
scoreboard(
|
|
||||||
'fzsd.module.scoreboard.assign.general',
|
|
||||||
system_total_name
|
|
||||||
) + INT_MIN
|
|
||||||
);
|
|
||||||
|
|
||||||
// 将总分赋值到显示计分板上
|
// 将总分赋值到显示计分板上
|
||||||
display_total_score(scoreboard);
|
display_total_score(scoreboard);
|
||||||
@ -427,14 +409,7 @@ get_total_score_name_new(scoreboard) -> (
|
|||||||
);
|
);
|
||||||
|
|
||||||
// 恢复总榜分数
|
// 恢复总榜分数
|
||||||
scoreboard(
|
scoreboard('fzsd.module.scoreboard.assign.general', sys_total_name, current_score);
|
||||||
'fzsd.module.scoreboard.assign.general',
|
|
||||||
system_total_name,
|
|
||||||
scoreboard(
|
|
||||||
'fzsd.module.scoreboard.assign.general',
|
|
||||||
system_total_name
|
|
||||||
) - INT_MIN
|
|
||||||
);
|
|
||||||
display_total_score(scoreboard);
|
display_total_score(scoreboard);
|
||||||
|
|
||||||
// 返回榜内最低分的玩家名(承载总榜数据的玩家名)
|
// 返回榜内最低分的玩家名(承载总榜数据的玩家名)
|
||||||
@ -452,7 +427,15 @@ command_recalculate_total_score(scoreboard) -> (
|
|||||||
total_score = 0;
|
total_score = 0;
|
||||||
for(scoreboard(scoreboard),
|
for(scoreboard(scoreboard),
|
||||||
if(_ != total_score_name_new,
|
if(_ != total_score_name_new,
|
||||||
total_score += scoreboard(scoreboard, _);
|
current_player_score = scoreboard(scoreboard, _);
|
||||||
|
if(current_player_score < 0, // 避免溢出
|
||||||
|
current_player_score = 2147483647;
|
||||||
|
scoreboard(scoreboard, _, 2147483647);
|
||||||
|
);
|
||||||
|
total_score += current_player_score;
|
||||||
|
);
|
||||||
|
if(total_score < 0, // 避免溢出
|
||||||
|
total_score = 2147483647;
|
||||||
);
|
);
|
||||||
);
|
);
|
||||||
// 赋值总分到系统总分计分板
|
// 赋值总分到系统总分计分板
|
||||||
@ -529,7 +512,7 @@ restore_score(player_name, scoreboard) -> (
|
|||||||
require_not_null(player_name);
|
require_not_null(player_name);
|
||||||
if(scoreboard == null,
|
if(scoreboard == null,
|
||||||
for(global_current_scoreboard_list, restore_score(player_name, _));
|
for(global_current_scoreboard_list, restore_score(player_name, _));
|
||||||
return();
|
return(true);
|
||||||
);
|
);
|
||||||
player = player(player_name);
|
player = player(player_name);
|
||||||
player_is_offline = false;
|
player_is_offline = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user