44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
import { SettingStatusEnum, status } from "../utils/SettingStatus.mjs";
|
|
import { __ID__ } from "../consts.mjs";
|
|
import { Logger } from "../utils/Logger.mjs";
|
|
import { preventTweakRegistration } from "../utils/preRegisterTweak.mjs";
|
|
import { StatusEffectIconConfig } from "../apps/StatusEffectIconConfig.mjs";
|
|
|
|
export const key = `customStatusIcons`;
|
|
|
|
export function customStatusIcons() {
|
|
status[key] = SettingStatusEnum.Unknown;
|
|
if (preventTweakRegistration(key)) { return };
|
|
|
|
// #region Registration
|
|
Logger.log(`Registering tweak: ${key}`);
|
|
game.settings.registerMenu(__ID__, `${key}Menu`, {
|
|
name: `OFT.menu.${key}.name`,
|
|
hint: `OFT.menu.${key}.hint`,
|
|
label: `OFT.menu.${key}.label`,
|
|
restricted: true,
|
|
type: StatusEffectIconConfig,
|
|
});
|
|
game.settings.register(__ID__, key, {
|
|
scope: `world`,
|
|
config: false,
|
|
type: Object,
|
|
default: {},
|
|
});
|
|
// #endregion Registration
|
|
|
|
// #region Implementation
|
|
Hooks.on(`ready`, () => {
|
|
const value = game.settings.get(__ID__, key);
|
|
|
|
const effects = Object.values(CONFIG.statusEffects);
|
|
for (const effect of effects) {
|
|
if (value[effect.id] != null) {
|
|
effect.img = value[effect.id];
|
|
};
|
|
};
|
|
});
|
|
// #endregion Implementation
|
|
|
|
status[key] = SettingStatusEnum.Registered;
|
|
};
|