mb-assets/src/packsrc/asset-macros/Set_Tree_Opacity_9mGisaPegF6F8Uex.json

29 lines
1.5 KiB
JSON

{
"folder": "1e5EaquD2GTpHlOW",
"name": "Set Tree Opacity",
"type": "script",
"_id": "9mGisaPegF6F8Uex",
"author": "sVoCvBU1knmXzoYe",
"img": "icons/environment/wilderness/tree-spruce.webp",
"scope": "global",
"command": "let opacity;\ntry {\n opacity = await foundry.applications.api.DialogV2.prompt({\n window: { title: \"Set Tree Opacity on current scene\" },\n content: '<input name=\"opacity\" type=\"number\" min=\"0\" max=\"1\" step=\"0.1\" value=\"0.7\" autofocus>',\n ok: {\n label: \"Set Opacity\",\n callback: (event, button, dialog) => button.form.elements.opacity.valueAsNumber\n }\n });\n} catch {\n console.log(\"User did not choose opacity.\");\n return;\n}\nif (!opacity) { \n console.log(\"no opacity set\")\n return\n}\nconsole.log(\"set opacity to \", opacity)\nlet treeCanopies = game.scenes.current.tiles.filter(t => Tagger.hasTags([t], ['TreeCanopy', 'TreeOverhead'], {matchAny: true}))\ngame.scenes.current.updateEmbeddedDocuments('Tile', treeCanopies.map(c => {\n return {\"_id\": c.id, \"alpha\": opacity}\n}))",
"sort": 200000,
"ownership": {
"default": 0,
"sVoCvBU1knmXzoYe": 3
},
"flags": {},
"_stats": {
"compendiumSource": null,
"duplicateSource": null,
"exportSource": null,
"coreVersion": "13.346",
"systemId": "swade",
"systemVersion": "5.0.3",
"createdTime": 1750556083913,
"modifiedTime": 1751220596934,
"lastModifiedBy": "sVoCvBU1knmXzoYe"
},
"_key": "!macros!9mGisaPegF6F8Uex"
}