特质注册

Estimated reading time: less than 1 minute

通过 maplebirch.tool.other.addTraits() 注册自定义特质。

可通过 maplebirch.tool.other.addTraits() 或快捷接口 maplebirchFrameworks.addTraits() 访问。

特质接口

字段类型说明
titlestring特质标题 / 分类
namestring特质标识名(必须)
colourstring显示颜色
hasFunction | string拥有条件(函数或表达式字符串)
textstring特质描述文本

示例

const other = maplebirch.tool.other;

other.addTraits({
  title: "一般特质",
  name: "brave",
  colour: "green",
  has: () => V.brave >= 1,
  text: "角色展现出勇气",
});

other.applyLocation();

说明

框架对特质添加做了内部解析与去重,避免重复或错误覆盖。maplebirch.tool.other.addTraits 的用法保持不变。