diff --git a/README.md b/README.md index c1faeb8..61d6d9d 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ![GitHub Releases](https://img.shields.io/github/downloads/KayelGee/token-attacher/latest/total?style=for-the-badge) ![GitHub All Releases](https://img.shields.io/github/downloads/KayelGee/token-attacher/total?style=for-the-badge&label=Downloads+total) -**[Compatibility]**: *FoundryVTT* v10+ +**[Compatibility]**: *FoundryVTT* v12+ **[Systems]**: *any* **[Languages]**: *English*, *Korean*, *Japanese* @@ -57,6 +57,9 @@ A public interface for usage in macros can be accessed via tokenAttacher, follow - tokenAttacher.regenerateLinks(elements) - tokenAttacher.migrateElementsInCompendiums(migrateFunc, elementTypes, topLevelOnly) - tokenAttacher.migrateAttachedOfBase(base, migrateFunc, elementTypes, topLevelOnly, return_data=false) + - tokenAttacher.migratePrototype(prototypeToken, migrateFunc, elementTypes, topLevelOnly, options={}) + - tokenAttacher.isAttachmentBase (document) + - tokenAttacher.transformBaseIntoPrototype(baseDocument) There are some example macros bundled in a macro compendium. - Mount Up!: diff --git a/module.json b/module.json index 3b68250..a408cd6 100644 --- a/module.json +++ b/module.json @@ -2,7 +2,7 @@ "id": "token-attacher", "title": "Token Attacher", "description": "Attach anything(even tokens) to tokens, so that they move when the token moves and rotate/move when the token rotates. Create prefabs and many more features, see the github readme for more details.", - "version": "4.6.4", + "version": "4.6.6", "compatibility" :{ "minimum": 12, "verified": 12, @@ -35,9 +35,8 @@ { "name": "example-macros", "label": "(TA)Example Macros", - "path": "packs/example-macros.db", - "type": "Macro", - "package": "token-attacher" + "path": "packs/example-macros", + "type": "Macro" } ], "languages": [ diff --git a/packs/example-macros.db b/packs/example-macros.db deleted file mode 100644 index 7def8c4..0000000 --- a/packs/example-macros.db +++ /dev/null @@ -1,21 +0,0 @@ -{"name":"(TA)Disable Token Animation","type":"script","author":"UMK8ApDowSTMXShS","img":"icons/svg/cancel.svg","scope":"global","command":"tokenAttacher.setAnimateStatus(canvas.activeLayer.controlled, false);","folder":null,"sort":0,"permission":{"default":0,"UMK8ApDowSTMXShS":3},"flags":{"core":{"sourceId":"Macro.RBEy5s5yuwFPmITc"}},"_id":"1ATNOSsJ0wFTpfwP"} -{"name":"(TA)Remove Template from Token","type":"script","author":"uWEZSwckuumggq1Y","img":"icons/svg/cancel.svg","scope":"global","command":"(async () =>{\nlet template = canvas.templates.get(tokenAttacher.getAllAttachedElementsByTypeOfToken(token, \"MeasuredTemplate\")[0]);\nawait tokenAttacher.detachElementFromToken(template , token);\ntemplate.document.delete();\n})()","folder":null,"sort":0,"permission":{"default":0,"uWEZSwckuumggq1Y":3},"flags":{"core":{"sourceId":"Macro.ZzYt1pa8YCxGgO4k"}},"_id":"4DFUaFWIl8LiBcWO"} -{"name":"(TA) disableAnimationForAllBaseTokensInCompendiums","type":"script","author":"UMK8ApDowSTMXShS","img":"icons/svg/dice-target.svg","scope":"global","command":"let migrateAnimate = (elem, type) => {\n\tsetProperty(elem, `flags.token-attacher.animate`, false);\n}\n\ntokenAttacher.migrateElementsInCompendiums(migrateAnimate, [\"Token\"], false);","folder":null,"sort":0,"permission":{"default":0,"UMK8ApDowSTMXShS":3},"flags":{"core":{"sourceId":"Macro.igj7AlOhK18qr0ZS"}},"_id":"5jvkFbZIWdbcPs2S"} -{"name":"(TA) Toggle hidden base+children","type":"script","author":"xjS2BHFYMZVu5P5i","img":"icons/svg/cowled.svg","scope":"global","command":"(async ()=>{\n\tlet mimicBaseHidden= (type, elementsdata, basedata) => {\n\t\tlet updates = [];\n\t\tfor (let i = 0; i < elementsdata.length; i++) {\n\t\t\tconst element = elementsdata[i];\n\t\t\tupdates.push({_id:element._id, hidden: basedata.hidden});\n\t\t}\n\t\treturn updates;\n\t}\n\t\n\ttoken.document.hidden = !token.document.hidden;\n\tlet updates = await tokenAttacher.migrateAttachedOfBase(token, mimicBaseHidden, [\"Token\", \"Tile\", \"Drawing\"], false, true);\n\ttoken.document.hidden = !token.document.hidden;\n\t\n\t//Add base hidden switch\n\tconst type = token.layer.constructor.documentName;\n\tif(!updates.hasOwnProperty(type)) updates[type] = [];\n\tupdates[type].push({_id:token.document._id, hidden:!token.document.hidden});\n\t\n\tconsole.log(updates);\n\t//Fire all updates by type\n\tfor (const key in updates) {\n\t\tawait canvas.scene.updateEmbeddedDocuments(key, updates[key], {['token-attacher']:{}});\n\t}\n\t})();","flags":{"core":{"sourceId":"Macro.dUYvNjxgXY8zdwsP"}},"ownership":{"default":0,"uWEZSwckuumggq1Y":3,"xjS2BHFYMZVu5P5i":3},"_stats":{"systemId":"dnd5e","systemVersion":"2.0.2","coreVersion":"10.285","createdTime":1664119880184,"modifiedTime":1664120423520,"lastModifiedBy":"xjS2BHFYMZVu5P5i"},"folder":null,"sort":0,"_id":"7m2jsyFs9omz8hX6"} -{"name":"(TA)Dismount/Drop Target","permission":{"default":0,"S9MNnXvNKVz78Wm1":3},"type":"script","flags":{"core":{"sourceId":"Macro.aPzz32JjvyQD0dBW"}},"scope":"global","command":"(async () => {\n\tlet targets = Array.from(game.user.targets);\n\tif(targets.length > 0){\n\t\tif(targets.length > 1) return ui.notification.error(\"Can't follow more then one token!\");\n\t\tawait tokenAttacher.detachElementsFromToken(targets, token, true);\n\t\tfor (let i = 0; i < targets.length; i++) {\n\t\t\tconst targ = targets[i];\n\t\t\tui.chat.processMessage(`Get off ${targ.name}!`);\n }\n\t}\n})();","author":"S9MNnXvNKVz78Wm1","img":"icons/svg/target.svg","actorIds":[],"_id":"8XmWcnGdttjbLMAm"} -{"name":"(TA) Propagate base hidden state to children","type":"script","author":"uWEZSwckuumggq1Y","img":"icons/svg/cowled.svg","scope":"global","command":"let mimicBaseHidden= (type, elementsdata, basedata) => {\n\tlet updates = [];\n\tfor (let i = 0; i < elementsdata.length; i++) {\n\t\tconst element = elementsdata[i];\n\t\tupdates.push({_id:element._id, hidden: basedata.hidden});\n\t}\n\treturn updates;\n}\n\ntokenAttacher.migrateAttachedOfBase(token, mimicBaseHidden, [\"Token\", \"Tile\", \"Drawing\"], false);","folder":null,"sort":0,"permission":{"default":0,"uWEZSwckuumggq1Y":3},"flags":{"core":{"sourceId":"Macro.dUYvNjxgXY8zdwsP"}},"_id":"A95dkHoNAamAK3Nu"} -{"name":"(TA) purge TA data in scene","type":"script","author":"xjS2BHFYMZVu5P5i","img":"icons/svg/cancel.svg","scope":"global","command":"(async ()=>{\t\t\n\tconst base_layer = \tcanvas.getLayerByEmbeddedName(\"Token\");\n\tconst moduleName = 'token-attacher';\n\tlet updates = {};\n\tconst pushUpdate = (key, update, updateObj) => {\n\t\tif(!updateObj.hasOwnProperty(key)) updateObj[key] = [];\n\t\tconst dupIndex = updateObj[key].findIndex(item => update._id=== item._id);\n\t\tif(dupIndex === -1) updateObj[key].push(update);\n\t};\n\tfor (const type of [\"AmbientLight\", \"AmbientSound\", \"Drawing\", \"MeasuredTemplate\", \"Note\", \"Tile\", \"Token\", \"Wall\"]) {\n\t\tconst layer = canvas.getLayerByEmbeddedName(type);\n\t\tconst deleteLinks = (layer) => {\n\t\t\t\tfor (let i = 0; i < layer.placeables.length; i++) {\n\t\t\t\t\tconst element = layer.placeables[i];\n\t\t\t\t\tif(getProperty(element.document, `flags.${moduleName}`)) pushUpdate(type, {_id:element.document._id, [`flags.-=${moduleName}`]:null}, updates);\n\t\t\t\t}\n\t\t\t}\n\t\tdeleteLinks(layer);\n\t\tif(type === \"Tile\" && canvas.foreground){\n\t\t\tdeleteLinks(canvas.foreground);\n\t\t}\n\t}\n\t//Fire updates\n\tfor (const key in updates){\n\t\tif (updates.hasOwnProperty(key)) {\n\t\t\tawait canvas.scene.updateEmbeddedDocuments(key, updates[key], {[moduleName]:{update:true}});\n\t\t}\n\t}\n\tconsole.log(\"All Token Attacher Data has been removed from scene.\");\n})();","flags":{"core":{"sourceId":"Macro.rX9i5A0Nxt7wpnX9"}},"ownership":{"default":0,"uWEZSwckuumggq1Y":3,"xjS2BHFYMZVu5P5i":3},"_stats":{"systemId":"dnd5e","systemVersion":"2.0.2","coreVersion":"10.285","createdTime":1664119495785,"modifiedTime":1664120653788,"lastModifiedBy":"xjS2BHFYMZVu5P5i"},"folder":null,"sort":0,"_id":"EB78g055JBtuiReP"} -{"name":"(TA)Follow Target!","permission":{"default":0,"S9MNnXvNKVz78Wm1":3},"type":"script","flags":{"core":{"sourceId":"Macro.cdqKK2v5kFOKxeO5"}},"scope":"global","command":"(async () => {\n\tlet targets = Array.from(game.user.targets);\n\tif(targets.length > 0){\n\t\tif(targets.length > 1) return ui.notification.error(\"Can't follow more then one token!\");\n\t\tui.chat.processMessage(`I follow ${targets[0].name}`);\n\t\tawait tokenAttacher.attachElementToToken(token, targets[0], true);\n await tokenAttacher.setElementsLockStatus(token, false, true);\n\t}\n})();","author":"S9MNnXvNKVz78Wm1","img":"icons/svg/anchor.svg","actorIds":[],"_id":"EEEmfwXesBWX7v2O"} -{"name":"(TA)Dismount/Drop all","permission":{"default":0,"S9MNnXvNKVz78Wm1":3},"type":"script","flags":{"core":{"sourceId":"Macro.X52GcPUPuT9HfjcR"}},"scope":"global","command":"(() => {\n tokenAttacher.detachAllElementsFromToken(token, true);\n ui.chat.processMessage(`Everyone and everything get off!`);\t\t\t\n})();","author":"S9MNnXvNKVz78Wm1","img":"icons/svg/falling.svg","actorIds":[],"_id":"IyCqa2HL5x07ybzf"} -{"name":"(TA)Remove Parent of selected Objects","type":"script","author":"Z4Ui8EZisKyIw48G","img":"icons/svg/dice-target.svg","scope":"global","command":"let updates = [];\ncanvas.activeLayer.controlled.forEach( c => {\nif(c.data.flags?.['token-attacher'].parent) \nupdates.push({\n_id:c.data._id, \n[`flags.token-attacher.-=parent`]: null, \n[`flags.token-attacher.-=offset`]: null\n})\n});\ncanvas.scene.updateEmbeddedDocuments(canvas.activeLayer.constructor.documentName, updates);","folder":null,"sort":0,"permission":{"default":0,"Z4Ui8EZisKyIw48G":3},"flags":{"core":{"sourceId":"Macro.FG8TW0zbKIcNRmJP"}},"_id":"KOobYaA4hDPoKyio"} -{"name":"(TA)Create Template and attach to Token","type":"script","author":"uWEZSwckuumggq1Y","img":"icons/svg/target.svg","scope":"global","command":"(async () => {\n let newTemplate= await canvas.scene.createEmbeddedDocuments('MeasuredTemplate', [{\n t: \"circle\",\n user: game.userId,\n x: token.center.x,\n y: token.center.y,\n direction: 0,\n distance: 20,\n borderColor: \"#44975C\",\n fillColor: \"#44975C\"\n }]);\n tokenAttacher.attachElementsToToken(newTemplate, token, false);\n})()","folder":null,"sort":0,"permission":{"default":0,"uWEZSwckuumggq1Y":3},"flags":{"core":{"sourceId":"Macro.jYNLOeOHa1G4nzaN"}},"_id":"LGTld5pqThXRWJWT"} -{"name":"(TA)Toggle Quick Edit Mode","permission":{"default":0,"El5JYRyNAovcZ1JK":3},"type":"script","flags":{"core":{"sourceId":"Macro.B0KxxJfRpqWy7UiO"}},"scope":"global","command":"tokenAttacher.toggleQuickEditMode()","author":"El5JYRyNAovcZ1JK","img":"modules/token-attacher/templates/images/quill-ink.svg","actorIds":[],"_id":"MVqhetyeMXuBCBOB"} -{"name":"(TA)Stop Follow!","permission":{"default":0,"S9MNnXvNKVz78Wm1":3},"type":"script","flags":{"core":{"sourceId":"Macro.Pa4D6xwfuxJS0nYR"}},"scope":"global","command":"(async () => {\n\tlet targets = Array.from(game.user.targets);\n\tif(targets.length > 0){\n\t\tif(targets.length > 1) return ui.notification.error(\"Can't unfollow more then one token!\");\n\t\tawait tokenAttacher.detachElementsFromToken([token], targets[0], true);\n\t\tui.chat.processMessage(`I walk my own path again.`);\n\t}\n})();","author":"S9MNnXvNKVz78Wm1","img":"icons/svg/wall-direction.svg","actorIds":[],"_id":"cgasM031hufbmXJ8"} -{"name":"(TA)Delete Missing Links","permission":{"default":0,"El5JYRyNAovcZ1JK":3},"type":"script","flags":{"core":{"sourceId":"Macro.B0KxxJfRpqWy7UiO"}},"scope":"global","command":"tokenAttacher.deleteMissingLinks()","author":"El5JYRyNAovcZ1JK","img":"icons/svg/bones.svg","actorIds":[],"_id":"gOSSlKyh8DU6sQba"} -{"name":"(TA)Toggle Token Animation","type":"script","author":"UMK8ApDowSTMXShS","img":"icons/skills/movement/figure-running-gray.webp","scope":"global","command":"tokenAttacher.toggleAnimateStatus(canvas.activeLayer.controlled);","folder":null,"sort":0,"permission":{"default":0,"UMK8ApDowSTMXShS":3},"flags":{"core":{"sourceId":"Macro.45pTXg1PosLVuvF8"}},"_id":"hY1Qvx6TSXYicKZJ"} -{"name":"(TA)Enable Token Animation","type":"script","author":"UMK8ApDowSTMXShS","img":"icons/skills/movement/figure-running-gray.webp","scope":"global","command":"tokenAttacher.setAnimateStatus(canvas.activeLayer.controlled, true);","folder":null,"sort":0,"permission":{"default":0,"UMK8ApDowSTMXShS":3},"flags":{"core":{"sourceId":"Macro.0HRPExO0ogMMIvOW"}},"_id":"mNF69LCY4AcM3RHu"} -{"name":"(TA) Migrate Actors for Wall Height","type":"script","author":"Z4Ui8EZisKyIw48G","img":"icons/svg/regen.svg","scope":"global","command":"(async ()=>{\n\tlet migrateWallHeight = (elem, type) => {\n\t\tif(elem.flags.wallHeight){\n\t\t\tconst oldTop = elem.flags.wallHeight.wallHeightTop;\n\t\t\tconst oldBottom = elem.flags.wallHeight.wallHeightBottom;\n\t\t\tif ((oldTop !== null && oldTop !== undefined) || (oldBottom !== null && oldBottom !== undefined)) {\n\t\t\t\tsetProperty(elem, `flags.wall-height`,{\n\t\t\t\t\ttop: oldTop,\n\t\t\t\t\tbottom: oldBottom\n\t\t\t\t});\n\t\t\t\tdelete elem.flags['wallHeight'];\n\t\t\t}\n\t\t}\n\t\tif(elem.flags['token-attacher']?.offset?.elevation?.flags?.wallHeight){\n\t\t\tconst oldOffsetTop = elem.flags?.['token-attacher']?.offset?.elevation?.flags?.wallHeight?.wallHeightTop;\n\t\t\tconst oldOffsetBottom = elem.flags?.['token-attacher']?.offset?.elevation?.flags?.wallHeight?.wallHeightBottom;\n\t\t\tif ((oldOffsetTop !== null && oldOffsetTop !== undefined) || (oldOffsetBottom !== null && oldOffsetBottom !== undefined)) {\n\t\t\t\tsetProperty(elem, `flags.token-attacher.offset.elevation.flags.wall-height`,{\n\t\t\t\t\ttop: oldOffsetTop,\n\t\t\t\t\tbottom: oldOffsetBottom\n\t\t\t\t});\n\t\t\t\tdelete elem.flags['token-attacher'].offset.elevation.flags.wallHeight;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tconsole.log(\"Token Attacher | \" + 'Migrating Actors...');\n\tconst allActors = [...game.actors].filter(actor =>{\n\t\tconst attached = getProperty(actor, `data.token.flags.token-attacher.prototypeAttached`) || {};\n\t\tif(Object.keys(attached).length > 0) return true;\n\t\treturn false;\n\t});\n\tfor (let i = 0; i < allActors.length; i++) {\n\t\tconst actor = allActors[i];\n\t\tconsole.log(\"Token Attacher | \" + 'Migrating ', actor);\n\t\tawait tokenAttacher.migrateElementsOfActor(actor, migrateWallHeight, [\"Wall\"], false);\n\t}\n\tconsole.log(\"Token Attacher | \" + 'Migrating Actors finished! Updated ' + allActors.length + ' actors.');\n})()","folder":null,"sort":0,"permission":{"default":0,"Z4Ui8EZisKyIw48G":3},"flags":{"core":{"sourceId":"Macro.4JtEZUVQeJysMz6V"}},"_id":"sB1QNWKtB3dumbaa"} -{"name":"(TA)Pick Up","permission":{"default":0,"S9MNnXvNKVz78Wm1":3},"type":"script","flags":{"core":{"sourceId":"Macro.5nYOmSZfXbhOmAwr"}},"scope":"global","command":"(async () => {\n\tlet targets = Array.from(game.user.targets);\n\tif(targets.length > 0){\n\t\tfor (let i = 0; i < targets.length; i++) {\n\t\t\tconst targ = targets[i];\n\t\t\tui.chat.processMessage(`I pick up this ${targ.name}`);\n\t\t}\n\t\tawait tokenAttacher.attachElementsToToken(targets, token, true);\n await tokenAttacher.setElementsLockStatus(targets, false, true);\n\t}\n})();","author":"S9MNnXvNKVz78Wm1","img":"icons/svg/sword.svg","actorIds":[],"_id":"vQZfGeU9mL8pwg1i"} -{"name":"(TA) migrateRoofsToBetterRoofs","type":"script","author":"UMK8ApDowSTMXShS","img":"icons/svg/dice-target.svg","scope":"global","command":"let migrateRoofs = (elem, type) => {\n\tlet roofMode = 3;\n\tif(getProperty(elem, `flags.roofs.isRoof`) \n\t|| (getProperty(elem, `overhead`) \n\t&& getProperty(elem, `occlusion.mode`) == 2)){\n\t\tsetProperty(elem, `flags.betterRoofs.brMode`, roofMode);\n\t\tsetProperty(elem, `occlusion.mode`, 1);\n\t}\n}\n\ntokenAttacher.migrateElementsInCompendiums(migrateRoofs, [\"Tile\"], false);","folder":null,"sort":0,"permission":{"default":0,"UMK8ApDowSTMXShS":3},"flags":{"core":{"sourceId":"Macro.fU2LkegSt3vo7dp8"}},"_id":"vZVaAvGxegN7jw1b"} -{"name":"(TA)Mount Up!","type":"script","author":"Z4Ui8EZisKyIw48G","img":"icons/svg/up.svg","scope":"global","command":"(async () => {\n\tlet targets = Array.from(game.user.targets);\n\tif(targets.length > 0){\n\t\tif(targets.length > 1) return ui.notification.error(\"Can't mount more then one token!\");\n\t\tlet mount = targets[0];\n\t\tlet newCoords = {x:token.x, y:token.y};\n\t\tif(mount.x+mount.w-token.w < token.x) newCoords.x = mount.x+mount.w-token.w;\n\t\telse if(mount.x > token.x) newCoords.x = mount.x;\n\n\t\tif(mount.y+mount.h-token.h < token.y) newCoords.y = mount.y+mount.h-token.h;\n\t\telse if(mount.y > token.y) newCoords.y = mount.y;\n\t\tawait token.document.update({x: newCoords.x, y: newCoords.y});\n\t\tui.chat.processMessage(`I mount this ${targets[0].name}`);\n\t\tawait tokenAttacher.attachElementToToken(token, targets[0], true);\n\t\tawait tokenAttacher.setElementsLockStatus(token, false, true);\n\t\tawait tokenAttacher.setElementsMoveConstrainedStatus(token, true, true, {type: tokenAttacher.CONSTRAINED_TYPE.TOKEN_CONSTRAINED});\n\t}\n})();","folder":null,"sort":0,"permission":{"default":0,"S9MNnXvNKVz78Wm1":3,"Z4Ui8EZisKyIw48G":3},"flags":{"core":{"sourceId":"Macro.zsfgPtRL0r8sLXaP"}},"_id":"xj65RMsyVuEs1tEK"} -{"name":"(TA) Migrate Compendiums for Wall Height","type":"script","author":"Z4Ui8EZisKyIw48G","img":"icons/svg/regen.svg","scope":"global","command":"(async ()=>{\n\tlet migrateWallHeight = (elem, type) => {\n\t\tif(elem.flags.wallHeight){\n\t\t\tconst oldTop = elem.flags.wallHeight.wallHeightTop;\n\t\t\tconst oldBottom = elem.flags.wallHeight.wallHeightBottom;\n\t\t\tif ((oldTop !== null && oldTop !== undefined) || (oldBottom !== null && oldBottom !== undefined)) {\n\t\t\t\tsetProperty(elem, `flags.wall-height`,{\n\t\t\t\t\ttop: oldTop,\n\t\t\t\t\tbottom: oldBottom\n\t\t\t\t});\n\t\t\t\tdelete elem.flags['wallHeight'];\n\t\t\t}\n\t\t}\n\t\tif(elem.flags['token-attacher']?.offset?.elevation?.flags?.wallHeight){\n\t\t\tconst oldOffsetTop = elem.flags?.['token-attacher']?.offset?.elevation?.flags?.wallHeight?.wallHeightTop;\n\t\t\tconst oldOffsetBottom = elem.flags?.['token-attacher']?.offset?.elevation?.flags?.wallHeight?.wallHeightBottom;\n\t\t\tif ((oldOffsetTop !== null && oldOffsetTop !== undefined) || (oldOffsetBottom !== null && oldOffsetBottom !== undefined)) {\n\t\t\t\tsetProperty(elem, `flags.token-attacher.offset.elevation.flags.wall-height`,{\n\t\t\t\t\ttop: oldOffsetTop,\n\t\t\t\t\tbottom: oldOffsetBottom\n\t\t\t\t});\n\t\t\t\tdelete elem.flags['token-attacher'].offset.elevation.flags.wallHeight;\n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\tconsole.log(\"Token Attacher | \" + 'Migrating Compendiums... Please be patient as this can take some time.');\n\ttokenAttacher.migrateElementsInCompendiums(migrateWallHeight, [\"Wall\"], false);\n})()","folder":null,"sort":0,"permission":{"default":0,"Z4Ui8EZisKyIw48G":3},"flags":{"core":{"sourceId":"Macro.e8RYnezs9JaABPbA"}},"_id":"xs3SwwsP2zDw5RHG"} diff --git a/packs/example-macros/000072.ldb b/packs/example-macros/000072.ldb new file mode 100644 index 0000000..cf17a28 Binary files /dev/null and b/packs/example-macros/000072.ldb differ diff --git a/packs/example-macros/CURRENT b/packs/example-macros/CURRENT new file mode 100644 index 0000000..0094dac --- /dev/null +++ b/packs/example-macros/CURRENT @@ -0,0 +1 @@ +MANIFEST-000067 diff --git a/packs/example-macros/LOCK b/packs/example-macros/LOCK new file mode 100644 index 0000000..e69de29 diff --git a/packs/example-macros/MANIFEST-000067 b/packs/example-macros/MANIFEST-000067 new file mode 100644 index 0000000..e786ce3 Binary files /dev/null and b/packs/example-macros/MANIFEST-000067 differ diff --git a/scripts/compatiblity/levels.js b/scripts/compatiblity/levels.js index 571d030..dc86612 100644 --- a/scripts/compatiblity/levels.js +++ b/scripts/compatiblity/levels.js @@ -36,12 +36,10 @@ } if(objData.flags[moduleName]?.hasOwnProperty('rangeTop') || objData.flags[moduleName]?.hasOwnProperty('rangeBottom')){ offset.elevation.flags[moduleName] = { - rangeTop:objData.flags[moduleName].rangeTop ?? null, - rangeBottom:objData.flags[moduleName].rangeBottom ?? null + rangeTop:objData.flags[moduleName].rangeTop ?? null }; if([null, Infinity, -Infinity].includes(offset.elevation.flags[moduleName].rangeTop) === false) offset.elevation.flags[moduleName].rangeTop -= base_elevation; - if([null, Infinity, -Infinity].includes(offset.elevation.flags[moduleName].rangeBottom) === false) offset.elevation.flags[moduleName].rangeBottom -= base_elevation; } } @@ -56,6 +54,10 @@ if(offset.elevation?.flags?.[moduleName]?.hasOwnProperty('rangeTop')){ if([null, Infinity, -Infinity].includes(offset.elevation?.flags?.[moduleName]?.rangeTop) === false) update[`flags.${moduleName}.rangeTop`] = baseOffset.elevation + offset.elevation.flags[moduleName].rangeTop; } + //V11 Compatibility for V12 + if(offset.elevation?.flags?.[moduleName]?.hasOwnProperty('rangeBottom')){ + if([null, Infinity, -Infinity].includes(offset.elevation?.flags?.[moduleName]?.rangeBottom) === false) update[`elevation`] = baseOffset.elevation + offset.elevation.flags[moduleName].rangeBottom; + } } Hooks.on(`${moduleNameTA}.doAttachmentsNeedUpdate`, doAttachmentsNeedUpdate);