跳到主要内容

setPartyMember 设置队伍成员

setPartyMember

类型: MethodDeclaration

所属类: CommandFunctionList

定义位置: command.ts

描述

设置队伍成员

参数

参数名类型描述默认值
\{ operation, actor, \}{
	operation: "add" \| "remove";
actor: [`ActorGetter`](https://github.com/Open-Yami-Community/open-yami-doc/blob/main/i18n/zh/docusaurus-plugin-content-docs/current/script/yami/yami.command.d.ts#L152);
} | - | - |

返回值

类型: CommandFunction

源代码

位置: 第 6874 行

protected setPartyMember({
operation,
actor,
}: {
operation: "add" | "remove";
actor: ActorGetter;
}): CommandFunction {
const getActor = Command.compileActor(actor);
switch (operation) {
case "add":
return () => {
const actor = getActor();
if (actor instanceof GlobalActor) {
Party.addMember(actor);
}
return true;
};
case "remove":
return () => {
const actor = getActor();
if (actor instanceof GlobalActor) {
Party.removeMember(actor);
}
return true;
};
}
}

文档生成时间:2026/2/1 16:51:39