diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5059d99..33d4bba 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,58 +1,35 @@ -name: Release Creation +name: Create Module Files For GitHub Release on: release: - types: [ published ] + types: [published] jobs: build: runs-on: ubuntu-latest permissions: contents: write + steps: - - uses: actions/checkout@v2 + - name: Checkout Repository + uses: actions/checkout@v3 # Substitute the Manifest and Download URLs in the module.json + - name: Extract Version From Tag + id: get_version + uses: battila7/get-version-action@v2 - - name: Substitute Manifest and Download Links For Versioned Ones - id: sub_release_manifest_version + - name: Modify Module Manifest With Release-Specific Values + id: sub_manifest_link_version uses: microsoft/variable-substitution@v1 with: files: 'src/module.json' env: - version: ${{github.event.release.tag_name}} + version: ${{steps.get_version.outputs.version-without-v}} url: https://github.com/${{github.repository}} manifest: https://github.com/${{github.repository}}/releases/latest/download/module.json download: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.zip - # for a FULL RELEASE - # - name: Substitute Manifest and Download Links For Versioned Ones - # if: "!github.event.release.prerelease" - # id: sub_release_manifest_version - # uses: microsoft/variable-substitution@v1 - # with: - # files: 'module.json' - # env: - # version: ${{github.event.release.tag_name}} - # url: https://github.com/${{github.repository}} - # manifest: https://github.com/${{github.repository}}/releases/latest/download/module.json - # download: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.zip - - # Substitute the Manifest and Download URLs in the module.json - # for a PRE RELEASE. Manifest pointing to live module.json on branch, - # which is updated after tag. - # - name: Substitute Manifest and Download Links For Versioned Ones - # if: "github.event.release.prerelease" - # id: sub_prerelease_manifest_version - # uses: microsoft/variable-substitution@v1 - # with: - # files: 'module.json' - # env: - # version: ${{github.event.release.tag_name}} - # url: https://github.com/${{github.repository}} - # manifest: https://raw.githubusercontent.com/${{github.repository}}/next/module.json - # download: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.zip - # Install packages. - run: npm install @@ -79,55 +56,9 @@ jobs: with: allowUpdates: true # Set this to false if you want to prevent updating existing releases name: ${{ github.event.release.name }} - draft: false - prerelease: false + draft: ${{ github.event.release.unpublished }} + prerelease: ${{ github.event.release.prerelease }} token: ${{ secrets.GITHUB_TOKEN }} artifacts: './src/module.json, ./module.zip' tag: ${{ github.event.release.tag_name }} body: ${{ github.event.release.body }} - - # Create a release for this specific version - # - name: Update Release with Files - # if: "!github.event.release.prerelease" - # id: create_version_release - # uses: ncipollo/release-action@v1 - # with: - # allowUpdates: true # Set this to false if you want to prevent updating existing releases - # name: ${{ github.event.release.name }} - # draft: false - # prerelease: false - # token: ${{ secrets.GITHUB_TOKEN }} - # artifacts: './module.json, ./module.zip' - # tag: ${{ github.event.release.tag_name }} - # body: ${{ github.event.release.body }} - - # OR create a pre-release for this specific version - # - name: Update Release with Files - # if: "github.event.release.prerelease" - # id: create_version_prerelease - # uses: ncipollo/release-action@v1 - # with: - # allowUpdates: true # Set this to false if you want to prevent updating existing releases - # name: ${{ github.event.release.name }} - # draft: false - # prerelease: true - # token: ${{ secrets.GITHUB_TOKEN }} - # artifacts: './module.json, ./module.zip' - # tag: ${{ github.event.release.tag_name }} - # body: ${{ github.event.release.body }} - - #update next branch - # - name: Prepare repository - # if: "github.event.release.prerelease" - # run: | - # git config --global user.name '${{github.actor}}' - # git config --global user.email '${{github.actor}}@users.noreply.github.com' - # git add module.json - # git stash - # git clean -f - # git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY" - # git fetch origin "next" - # git switch -c "next" "origin/next" - # git checkout stash module.json - # git commit -m "${{github.event.release.tag_name}} manifest" - # git push -f diff --git a/README.md b/README.md index 8666837..f215dbe 100644 --- a/README.md +++ b/README.md @@ -268,16 +268,6 @@ To interact with a door, journal, ecc., the player need to have a token selected ![](/wiki/images/flag_stairway.png) -### Reset Doors and Fog feature Feature (deprecated and removed on v11) - -~~Adds a button to the Walls Menu to Shut all doors in the current scene. Also adds a menu to the context dropdown for the Scene Navigation and Scene Directory menus to shut all doors and delete fog in the selected scene to prepare it for a fresh visit from characters. I find it useful after QAing a new map for holes in walls/doors and checking lighting, etc.~~ - -~~Changes the functionality from closing ALL doors to closing ONLY opened doors. Doors that are currently locked remain locked, and are not closed.~~ - -~~### [Experimental] Integration of [Combat Range Overlay](https://github.com/Nazrax/fvtt-combat-range-overlay)~~ - -~~[Here the documentation](./wiki/docs/combat-range-overlay.md)~~ - # Build ## Install all packages @@ -382,13 +372,4 @@ Thanks to anyone who helps me with this code! I appreciate the user community's - [Rideable](https://github.com/Saibot393/Rideable) TY TO [Saibot393](https://github.com/Saibot393/) A very big thanks to [manuelVo](https://github.com/manuelVo), because i was to stupid to understand thing like measurement of Foundry by myself. -A very big thanks to [Saibot393](https://github.com/Saibot393/), and his GeometricUtils class for token distance calculation. - - -## Acknowledgements - -Bootstrapped with League of Extraordinary FoundryVTT Developers [foundry-vtt-types](https://github.com/League-of-Foundry-Developers/foundry-vtt-types). - -Mad props to the 'League of Extraordinary FoundryVTT Developers' community which helped me figure out a lot. - - +A very big thanks to [Saibot393](https://github.com/Saibot393/), and his GeometricUtils class for token distance calculation. \ No newline at end of file diff --git a/changelog.md b/changelog.md index e69bf37..b3e6092 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ # CHANGELOG +### 2.4.2 + +- Add v12 manifest compatibility ### 2.4.1 diff --git a/src/languages/en.json b/src/languages/en.json index 14672e4..4b01612 100644 --- a/src/languages/en.json +++ b/src/languages/en.json @@ -240,6 +240,9 @@ "arms-reach.settingNameMaximumTemplateMeasurementInteraction": "Maximum template interaction distance measurement (ft, mt, ...),", "arms-reach.settingHintMaximumTemplateMeasurementInteraction": "Is the distance calculation used only for the template", + "arms-reach.settingNameEnableAdditionalReachSettingOnPlaceableConfigSheet": "Enable additional reach setting on placeable config sheet", + "arms-reach.settingHintEnableAdditionalReachSettingOnPlaceableConfigSheet": "If enable it will let you set a specific value for the specific placeable object", + "arms-reach.setting.reset.name": "Reset settings to default", "arms-reach.setting.reset.label": "Reset Settings To Default", "arms-reach.setting.reset.hint": "This will reset all of the settings of back to the active game system's default.", diff --git a/src/module.json b/src/module.json index fefe1e7..75f9cc1 100644 --- a/src/module.json +++ b/src/module.json @@ -2,7 +2,7 @@ "id": "arms-reach", "title": "Arms Reach", "description": "Allows the GM to limit the distance that a player can interacted with a placeable object like door, journal, stairway, token, ecc..", - "version": "2.4.1", + "version": "2.4.2", "authors": [ { "name": "Psyny" @@ -87,15 +87,14 @@ "compatibility": { "minimum": 11, "verified": 11, - "maximum": 11 + "maximum": 12 }, "url": "https://github.com/p4535992/foundryvtt-arms-reach", - "manifest": "https://github.com/p4535992/foundryvtt-arms-reach/releases/download/2.4.1/module.json", - "download": "https://github.com/p4535992/foundryvtt-arms-reach/releases/download/2.4.1/module.zip", + "manifest": "https://github.com/p4535992/foundryvtt-arms-reach/releases/download/2.4.2/module.json", + "download": "https://github.com/p4535992/foundryvtt-arms-reach/releases/download/2.4.2/module.zip", "readme": "https://github.com/p4535992/foundryvtt-arms-reach/blob/main/README.md", "changelog": "https://github.com/p4535992/foundryvtt-arms-reach/blob/main/changelog.md", "bugs": "https://github.com/p4535992/foundryvtt-arms-reach/issues", - "allowBugReporter": true, "relationships": { "systems": [], "requires": [ diff --git a/src/scripts/lib/ArmsReachFormConfig.js b/src/scripts/lib/ArmsReachFormConfig.js index 8840fa8..66f94ae 100644 --- a/src/scripts/lib/ArmsReachFormConfig.js +++ b/src/scripts/lib/ArmsReachFormConfig.js @@ -1,4 +1,5 @@ import CONSTANTS from "../constants"; +import Logger from "./Logger"; export class ArmsReachFormConfig { static configHandlers = { @@ -15,6 +16,10 @@ export class ArmsReachFormConfig { }; static _handleRenderFormApplication(app, html) { + if (!game.settings.get(CONSTANTS.MODULE_ID, "enableAdditionalReachSettingOnPlaceableConfigSheet")) { + Logger.debug("Setting 'enableAdditionalReachSettingOnPlaceableConfigSheet' is disabled"); + return; + } let method = ArmsReachFormConfig.configHandlers[app.constructor.name]; if (!method) { const key = Object.keys(ArmsReachFormConfig.configHandlers).find((name) => @@ -27,33 +32,57 @@ export class ArmsReachFormConfig { } static _handleTokenConfig(app, html) { + if (!game.settings.get(CONSTANTS.MODULE_ID, "enableAdditionalReachSettingOnPlaceableConfigSheet")) { + Logger.debug("Setting 'enableAdditionalReachSettingOnPlaceableConfigSheet' is disabled"); + return; + } const elem = html.find(`div[data-tab="character"]`); this._applyHtml(app, elem); } static _handleTileConfig(app, html) { + if (!game.settings.get(CONSTANTS.MODULE_ID, "enableAdditionalReachSettingOnPlaceableConfigSheet")) { + Logger.debug("Setting 'enableAdditionalReachSettingOnPlaceableConfigSheet' is disabled"); + return; + } const elem = html.find(`div[data-tab="basic"]`); this._applyHtml(app, elem); } static _handleDrawingConfig(app, html) { + if (!game.settings.get(CONSTANTS.MODULE_ID, "enableAdditionalReachSettingOnPlaceableConfigSheet")) { + Logger.debug("Setting 'enableAdditionalReachSettingOnPlaceableConfigSheet' is disabled"); + return; + } const elem = html.find(`div[data-tab="position"]`); this._applyHtml(app, elem); } static _handleAmbientLightConfig(app, html) { + if (!game.settings.get(CONSTANTS.MODULE_ID, "enableAdditionalReachSettingOnPlaceableConfigSheet")) { + Logger.debug("Setting 'enableAdditionalReachSettingOnPlaceableConfigSheet' is disabled"); + return; + } let button = html.find(`button[name="submit"]`); let elem = (button.length ? button : html.find(`button[type="submit"]`)).parent(); this._applyHtml(app, elem, true); } static _handleGenericConfig(app, html) { + if (!game.settings.get(CONSTANTS.MODULE_ID, "enableAdditionalReachSettingOnPlaceableConfigSheet")) { + Logger.debug("Setting 'enableAdditionalReachSettingOnPlaceableConfigSheet' is disabled"); + return; + } let button = html.find(`button[name="submit"]`); let elem = button.length ? button : html.find(`button[type="submit"]`); this._applyHtml(app, elem, true); } static _handleStairwayConfig(app, html) { + if (!game.settings.get(CONSTANTS.MODULE_ID, "enableAdditionalReachSettingOnPlaceableConfigSheet")) { + Logger.debug("Setting 'enableAdditionalReachSettingOnPlaceableConfigSheet' is disabled"); + return; + } const elem = html.find(`div[data-tab="label"]`); this._applyHtml(app, elem, true); } diff --git a/src/scripts/settings.js b/src/scripts/settings.js index 9ee0ada..8d2fd52 100644 --- a/src/scripts/settings.js +++ b/src/scripts/settings.js @@ -72,6 +72,15 @@ export const registerSettings = function () { type: Boolean, }); + game.settings.register(CONSTANTS.MODULE_ID, "enableAdditionalReachSettingOnPlaceableConfigSheet", { + name: `${CONSTANTS.MODULE_ID}.settingNameEnableAdditionalReachSettingOnPlaceableConfigSheet`, + hint: `${CONSTANTS.MODULE_ID}.settingHintEnableAdditionalReachSettingOnPlaceableConfigSheet`, + scope: "world", + config: true, + default: true, + type: Boolean, + }); + // ======================================================== // DOOR SUPPORT // ======================================================== diff --git a/utils/packs.mjs b/utils/packs.mjs index 2fc7550..2e7d0fd 100644 --- a/utils/packs.mjs +++ b/utils/packs.mjs @@ -105,6 +105,13 @@ function cleanPackEntry(data, { clearSourceId=true, ownership=0 }={}) { if ( data.system?.save?.dc === 0 ) data.system.save.dc = null; if ( data.system?.capacity?.value === 0 ) data.system.capacity.value = null; if ( data.system?.strength === 0 ) data.system.strength = null; + // BREAKING CHANGES Dnd5e 3.2.X + if ((data.system?.weight || data.system?.weight === 0) && !data.system?.weight?.units) { + data.system.weight = { + value: typeof data.system.weight === 'number' ? data.system.weight : 0, + units: "lb" + }; + } // Remove mystery-man.svg from Actors if ( ["character", "npc"].includes(data.type) && data.img === "icons/svg/mystery-man.svg" ) {