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