change flags

This commit is contained in:
psitacus 2025-07-11 18:38:48 -06:00
parent 896f317c6d
commit fbe551624d
4 changed files with 6 additions and 4 deletions

View file

@ -7,3 +7,5 @@ export const encounterCountdown = {
simple: 'countdown-encounter-simple',
position: 'countdown-encounter-position'
};
export const itemAttachmentSource = 'attachmentSource';

View file

View file

@ -32,9 +32,9 @@ export async function copyAttachmentEffectsToActor({ parentItem, attachedItem, a
effectData.flags = {
...effectData.flags,
daggerheart: {
...effectData.flags?.daggerheart,
attachmentSource
[CONFIG.DH.id]: {
...effectData.flags?.[CONFIG.DH.id],
[CONFIG.DH.FLAGS.itemAttachmentSource]: attachmentSource
}
};
effectsToCreate.push(effectData);
@ -61,7 +61,7 @@ export async function removeAttachmentEffectsFromActor({ parentItem, attachedUui
const parentUuidProperty = `${parentType}Uuid`;
const effectsToRemove = actor.effects.filter(effect => {
const attachmentSource = effect.flags?.daggerheart?.attachmentSource;
const attachmentSource = effect.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.itemAttachmentSource);
return attachmentSource &&
attachmentSource[parentUuidProperty] === parentItem.uuid &&
attachmentSource.itemUuid === attachedUuid;