Skip to content

Commit

Permalink
Remove rangeBottom from levels when setting offset
Browse files Browse the repository at this point in the history
Add compatiblity to offsetting so elements on scene still have the correct offset without needing to migrate
Add macro for migratinon of rangeBottom in Compendiums
Update to readme
  • Loading branch information
KayelGee committed Jun 23, 2024
1 parent 0b55a28 commit a0b4bb5
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 29 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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*

Expand Down Expand Up @@ -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!:
Expand Down
7 changes: 3 additions & 4 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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": [
Expand Down
21 changes: 0 additions & 21 deletions packs/example-macros.db

This file was deleted.

Binary file added packs/example-macros/000072.ldb
Binary file not shown.
1 change: 1 addition & 0 deletions packs/example-macros/CURRENT
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MANIFEST-000067
Empty file added packs/example-macros/LOCK
Empty file.
Binary file added packs/example-macros/MANIFEST-000067
Binary file not shown.
8 changes: 5 additions & 3 deletions scripts/compatiblity/levels.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand All @@ -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);
Expand Down

0 comments on commit a0b4bb5

Please sign in to comment.