WI: exclude characterFilter fields from new entry template
| @@ -1146,7 +1146,7 @@ function registerWorldInfoSlashCommands() { | ||
| 1146 | 1146 | |
| 1147 | 1147 | // handle special cases, otherwise execute default logic |
| 1148 | 1148 | let fieldValue; |
| 1149 | 1149 | switch (field) { |
| 1150 | 1150 | case 'characterFilterNames': |
| 1151 | 1151 | if (entry.characterFilter) { |
| 1152 | 1152 | fieldValue = entry.characterFilter.names; |
| @@ -1261,7 +1261,7 @@ function registerWorldInfoSlashCommands() { | ||
| 1261 | 1261 | // handle special cases, otherwise execute default logic |
| 1262 | 1262 | let tagNames; |
| 1263 | 1263 | let charNames; |
| 1264 | 1264 | switch (field) { |
| 1265 | 1265 | case 'characterFilterNames': |
| 1266 | 1266 | createCharacterFilterFieldObjectIfNeeded(entry); |
| 1267 | 1267 | charNames = parseStringArray(value); |
| @@ -3608,7 +3608,7 @@ export async function deleteWorldInfoEntry(data, uid, { silent = false } = {}) { | ||
| 3608 | 3608 | * |
| 3609 | 3609 | * Use `newEntryTemplate` if you just need the template that contains default values |
| 3610 | 3610 | * |
| 3611 | 3611 | * @type {{[key: string]: { default: any, type: string, excludeFromTemplate?: boolean }}} |
| 3612 | 3612 | */ |
| 3613 | 3613 | export const newWorldInfoEntryDefinition = { |
| 3614 | 3614 | key: { default: [], type: 'array' }, |
| @@ -3647,13 +3647,13 @@ export const newWorldInfoEntryDefinition = { | ||
| 3647 | 3647 | sticky: { default: null, type: 'number?' }, |
| 3648 | 3648 | cooldown: { default: null, type: 'number?' }, |
| 3649 | 3649 | delay: { default: null, type: 'number?' }, |
| 3650 | 3650 | characterFilterNames: { default: [], type: 'array', excludeFromTemplate: true }, |
| 3651 | 3651 | characterFilterTags: { default: [], type: 'array', excludeFromTemplate: true }, |
| 3652 | 3652 | characterFilterExclude: { default: false, type: 'boolean', excludeFromTemplate: true }, |
| 3653 | 3653 | }; |
| 3654 | 3654 | |
| 3655 | 3655 | export const newWorldInfoEntryTemplate = Object.fromEntries( |
| 3656 | 3656 | Object.entries(newWorldInfoEntryDefinition).filter(([_, value]) => !value.excludeFromTemplate).map(([key, value]) => [key, value.default]), |
| 3657 | 3657 | ); |
| 3658 | 3658 | |
| 3659 | 3659 | /** |