Add player list command

Signed-off-by: szdytom <szdytom@qq.com>
This commit is contained in:
方而静 2023-10-07 10:05:05 +08:00
parent 16dd19ab7f
commit 0918848402
Signed by: szTom
GPG Key ID: 072D999D60C6473C
5 changed files with 65 additions and 13 deletions

View File

@ -23,7 +23,7 @@ ICollect-Alpha 是一个使用 [Carpet 脚本](https://github.com/gnembon/fabric
1. 发射火球发射与TNT爆炸威力相同的恶魂火球。 1. 发射火球发射与TNT爆炸威力相同的恶魂火球。
2. 发射烟花:发射可以造成大量伤害的烟花火箭。 2. 发射烟花:发射可以造成大量伤害的烟花火箭。
3. 建筑烟花发射在其下方生成道路的烟花火箭道路建筑材料为_石化橡木台阶_ 3. 建筑烟花:发射在其下方生成道路的烟花火箭(道路建筑材料为 _石化橡木台阶_)。
【指令使用】 【指令使用】
1. `/ica`:列出物品收集目标和时限信息 1. `/ica`:列出物品收集目标和时限信息
@ -33,6 +33,7 @@ ICollect-Alpha 是一个使用 [Carpet 脚本](https://github.com/gnembon/fabric
5. `/ica refill`:刷新自己的烟花 5. `/ica refill`:刷新自己的烟花
6. `/ica locate <name>`:定位某一玩家位置,空手使用时可获得指向位置的指南针(不能跨维度定位) 6. `/ica locate <name>`:定位某一玩家位置,空手使用时可获得指向位置的指南针(不能跨维度定位)
7. `/ica spyglass <feature>`:切换望远镜的能力 7. `/ica spyglass <feature>`:切换望远镜的能力
7. `/ica ps`:查看玩家列表,狼人可看到队友
7. `/ica-vote`:查看当前投票状态信息 7. `/ica-vote`:查看当前投票状态信息
8. `/ica-vote abstain`:投弃权票 8. `/ica-vote abstain`:投弃权票
9. `/ica-vote sus <name>`:投票给某一玩家 9. `/ica-vote sus <name>`:投票给某一玩家
@ -43,14 +44,15 @@ ICollect-Alpha 是一个使用 [Carpet 脚本](https://github.com/gnembon/fabric
首先需要安装 Fabric 和 Fabric Carpet 模组,然后将 `src` 目录下的 `.sc` 代码复制到世界的 `script` 文件夹下。打开世界后,使用 `/script load ica-loader` 加载加载脚本,使用命令 `/ica-loader` 加载各个模块: 首先需要安装 Fabric 和 Fabric Carpet 模组,然后将 `src` 目录下的 `.sc` 代码复制到世界的 `script` 文件夹下。打开世界后,使用 `/script load ica-loader` 加载加载脚本,使用命令 `/ica-loader` 加载各个模块:
- 使用 `/ica-setting career <career> <number>` 设置职业的玩家数量 - `/ica-setting career <career> <number>` 设置职业的玩家数量
- 使用 `/ica-setting add <item>` 设置一个未使用的收集目标 - `/ica-setting add <item>` 设置一个未使用的收集目标
- 使用 `/ica-setting set <slot> <item>` 设置一个指定的收集目标 - `/ica-setting set <slot> <item>` 设置一个指定的收集目标
- 使用 `/ica-admin confirm` 开始游戏,开始时请保证所有参与者在线 - `/ica-admin confirm` 开始游戏,开始时请保证所有参与者在线
## 调试命令 ## 调试命令
- 使用 `/ica-effect-applier enable` 强制启用状态效果广播 - `/ica-effect-applier enable` 强制启用状态效果广播
- 使用 `/ica-effect-applier enable` 强制禁用状态效果广播 - `/ica-effect-applier enable` 强制禁用状态效果广播
- 使用 `/ica-admin cancel` 终止游戏 - `/ica-admin reset` 终止游戏
- `/ica-i18n dump` 向 JSON 文件中写入本地化值
- `/bossbar set ica:prepare_counter value 20` 强制跳过准备阶段

View File

@ -1,6 +1,10 @@
__config() -> { __config() -> {
'scope' -> 'global', 'scope' -> 'global',
'exports' -> ['getLocaleKey', 'useIcaInstead', 'startedReject', 'pendingReject'], 'exports' -> ['getLocaleKey', 'useIcaInstead', 'startedReject', 'pendingReject'],
'command_permission' -> 'ops',
'commands' -> {
'dump' -> 'cmdDump',
},
}; };
global_TranslateKeysEnUS = { global_TranslateKeysEnUS = {
@ -47,7 +51,7 @@ global_TranslateKeysEnUS = {
'career.display.hunter' -> ' - Hunter(Fireball): %d participants.', 'career.display.hunter' -> ' - Hunter(Fireball): %d participants.',
'career.display.firework_hunter' -> ' - Hunter(Firework): %d participants.', 'career.display.firework_hunter' -> ' - Hunter(Firework): %d participants.',
'career.display.builder' -> ' - Builder: %d participants.', 'career.display.builder' -> ' - Builder: %d participants.',
'career.display.piggy' -> '- Piggies: whatever the rest.', 'career.display.piggy' -> ' - Piggies: whatever the rest.',
'career.set' -> 'Career %s set to %d participants.', 'career.set' -> 'Career %s set to %d participants.',
'career.title.bystander' -> 'Bystander', 'career.title.bystander' -> 'Bystander',
@ -106,7 +110,7 @@ global_TranslateKeysEnUS = {
'list.item.id' -> '#%d: ', 'list.item.id' -> '#%d: ',
'vote.title' -> 'There are %d candidates:', 'vote.title' -> 'There are %d candidates:',
'vote.deceased' -> '[deceased]', 'vote.deceased' -> '[Deceased]',
'vote.amount.1' -> '[%02d vote]', 'vote.amount.1' -> '[%02d vote]',
'vote.amount.2' -> '[%02d votes]', 'vote.amount.2' -> '[%02d votes]',
'vote.footer' -> 'Current elected: ', 'vote.footer' -> 'Current elected: ',
@ -124,6 +128,13 @@ global_TranslateKeysEnUS = {
'seed.title' -> 'Map Seed: ', 'seed.title' -> 'Map Seed: ',
'ps.wolf' -> '[Wolf]',
'ps.button.locate' -> '[Click To Locate]',
'ps.marker' -> ' - ',
'ps.me' -> '[You]',
'ps.offline' -> '[Offline]',
'ps.title' -> 'There are %d participants:',
'misc.clipboard' -> 'Click To Copy', 'misc.clipboard' -> 'Click To Copy',
'license.header' -> 'ICollect-Alpha, Copyright (C) 2023 方而静\nICollect-Alpha comes with ABSOLUTELY NO WARRANTY;\nfor details type \'/ica-loader show w\'.\nThis is free software, and you are welcome to redistribute it\nunder certain conditions; type \'/ica-loader show c\' for details.' 'license.header' -> 'ICollect-Alpha, Copyright (C) 2023 方而静\nICollect-Alpha comes with ABSOLUTELY NO WARRANTY;\nfor details type \'/ica-loader show w\'.\nThis is free software, and you are welcome to redistribute it\nunder certain conditions; type \'/ica-loader show c\' for details.'
@ -150,3 +161,7 @@ pendingReject() -> (
, 'mb /ica-admin confirm', '?/ica-admin confirm' , 'mb /ica-admin confirm', '?/ica-admin confirm'
, ' ' + getLocaleKey('reject.pending.after'))); , ' ' + getLocaleKey('reject.pending.after')));
); );
cmdDump() -> (
write_file('ica-i18n-keys.json', 'shared_json', global_TranslateKeysEnUS);
);

View File

@ -26,6 +26,7 @@ cmdLoad() -> (
run('script load ica'); run('script load ica');
run('script load ica-vote'); run('script load ica-vote');
run('script load ica-settings'); run('script load ica-settings');
run('script load ica-i18n');
); );
cmdShowW() -> ( cmdShowW() -> (

View File

@ -38,7 +38,7 @@ cmdSet(slot_id, goal_item_tuple) -> (
put(nbt_storage('ica:data'), 'Goals', etag, -1); put(nbt_storage('ica:data'), 'Goals', etag, -1);
print(format(' ' + str(getLocaleKey('goal.set.before'), slot_id) print(format(' ' + str(getLocaleKey('goal.set.before'), slot_id)
, 'b ' + item_display_name(goal_item_tuple:0), '^ minecraft:' + goal_item_tuple:0 , 'b ' + item_display_name(goal_item_tuple:0), '^ minecraft:' + goal_item_tuple:0
, ' ' + getLocaleKey('goal.set.after')); , ' ' + getLocaleKey('goal.set.after')));
if(getFirstUnsetGoal() > 5, ( if(getFirstUnsetGoal() > 5, (
print(format(' ' + getLocaleKey('hint.allset.before') print(format(' ' + getLocaleKey('hint.allset.before')
, 'mb /ica-admin confirm', '?/ica-admin confirm' , 'mb /ica-admin confirm', '?/ica-admin confirm'

View File

@ -9,6 +9,8 @@ __config() -> {
'whoami' -> 'cmdMe', 'whoami' -> 'cmdMe',
'locate <participant>' -> 'cmdLocate', 'locate <participant>' -> 'cmdLocate',
'spyglass <spyglass_feature>' -> 'cmdSpyglassSwitch', 'spyglass <spyglass_feature>' -> 'cmdSpyglassSwitch',
'ps' -> 'cmdListPalyer',
'playerlist' -> 'cmdListPalyer',
}, },
'arguments' -> { 'arguments' -> {
'slot' -> { 'type' -> 'int', 'min' -> 0, 'max' -> 5 'slot' -> { 'type' -> 'int', 'min' -> 0, 'max' -> 5
@ -20,7 +22,8 @@ __config() -> {
) )
)}, )},
'spyglass_feature' -> { 'type' -> 'string', 'spyglass_feature' -> { 'type' -> 'string',
'options' -> [ 'builder', 'firework', 'fireball' ] } 'options' -> [ 'builder', 'firework', 'fireball' ] },
'message' -> { 'type' -> 'text' },
} }
}; };
@ -243,3 +246,34 @@ cmdSubmit(slot_id) -> (
bossbar('ica:collected', 'value', iv); bossbar('ica:collected', 'value', iv);
print(getLocaleKey('submit.success')); print(getLocaleKey('submit.success'));
); );
cmdListPalyer() -> (
if(!nbt_storage('ica:data'):'Started', (
pendingReject();
return(false)
));
me = player();
cand_names = parse_nbt(nbt_storage('ica:voting'):'Candidates');
cand_n = length(cand_names);
print(str(getLocaleKey('ps.title'), cand_n));
for(cand_names, (
p = player(_);
fcomp = [' ' + getLocaleKey('ps.marker')];
if(p == null, (
put(fcomp, null, 'g ' + _);
put(fcomp, null, ' ' + getLocaleKey('ps.offline'));
), (
put(fcomp, null, if(query(p, 'has_scoreboard_tag', 'ica.deceased')
, 's ', 'b ') + _);
if(p == me, (
put(fcomp, null, ' ' + getLocaleKey('ps.me'));
));
if(query(me, 'has_scoreboard_tag', 'ica.wolf')
&& query(p, 'has_scoreboard_tag', 'ica.wolf'), (
put(fcomp, null, ' ' + getLocaleKey('ps.wolf'));
));
));
print(format(fcomp));
));
);