Skip to content

Commit

Permalink
Merge branch 'release/0.5.12' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
caewok committed Jan 3, 2024
2 parents fc9154d + 0abe0bd commit 44a9420
Show file tree
Hide file tree
Showing 26 changed files with 929 additions and 679 deletions.
174 changes: 137 additions & 37 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,145 @@
name: Release Creation
# GitHub Actions workflow for creating a new FoundryVTT module release.
#
# Useful References:
# - https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
# - https://docs.github.com/en/actions/learn-github-actions/contexts
# - https://docs.github.com/en/actions/learn-github-actions/environment-variables
#
# Troubleshooting Checklist:
# - Is the module's manifest file valid JSON?
# You can test your manifest file using https://jsonlint.com/.
#
# - Does the module's manifest have all the required keys?
# See https://foundryvtt.com/article/module-development/#manifest for more
# information.
#
# - Are all the proper files and directories being included in the release's
# module archive ("module.zip")?
# Check that the correct files are being passed to the `zip` command run
# in the "Create Module Archive" step below.
#
# - Is the release tag the proper format?
# See the comments for the "Extract Version From Tag" step below.
#
# - Is a GitHub release being published?
# This workflow will only run when a release is published, not when a
# release is updated. Furthermore, note that while a GitHub release will
# (by default) create a repository tag, a repository tag will not create
# or publish a GitHub release.
#
# - Has the module's entry on FoundryVTT's module administration site
# (https://foundryvtt.com/admin) been updated?
#
name: Create Module Files For GitHub Release

on:

env:
# The URL used for the module's "Project URL" link on FoundryVTT's website.
project_url: "https://github.com/${{github.repository}}"

# A URL that will always point to the latest manifest.
# FoundryVTT uses this URL to check whether the current module version that
# is installed is the latest version. This URL should NOT change,
# otherwise FoundryVTT won't be able to perform this check.
latest_manifest_url: "https://github.com/${{github.repository}}/releases/latest/download/module.json"

# The URL to the module archive associated with the module release being
# processed by this workflow.
release_module_url: "https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.zip"


on:
# Only run this workflow when a release is published.
# To modify this workflow when other events occur, see:
# - https://docs.github.com/en/actions/using-workflows/triggering-a-workflow
# - https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
# - https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
#
# Note that some steps may depend on context variables that are only
# available for release events, so if you add other events, you may need to
# alter other parts of this workflow.
release:
types: [published]


jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v3
with:
submodules: 'true'

# get part of the tag after the `v`
- id: get_version
run: |
echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
echo "FOUNDRY_MANIFEST=https://github.com/${{github.repository}}/releases/latest/download/module.json" >> $GITHUB_ENV
echo "FOUNDRY_DOWNLOAD=https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.zip" >> $GITHUB_ENV
# Substitute the Manifest and Download URLs in the module.json
- name: Substitute Manifest and Download Links For Versioned Ones
id: sub_manifest_link_version
uses: restackio/[email protected]
with:
file: 'module.json'
fields: "{\"version\": \"${{env.VERSION}}\", \"manifest\": \"${{env.FOUNDRY_MANIFEST}}\", \"download\": \"${{env.FOUNDRY_DOWNLOAD}}\"}"

# Create a zip file with all files required by the module to add to the release
- run: zip -r ./module.zip module.json LICENSE styles/ scripts/ templates/ languages/ packs/

# Create a release for this specific version
- name: Update Release with Files
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
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: './module.json, ./module.zip'
tag: ${{ github.event.release.tag_name }}
body: ${{ github.event.release.body }}
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: 'true'

# Extract version embedded in the tag.
# This step expects the tag to be one of the following formats:
# - "v<major>.<minor>.<patch>" (e.g., "v1.2.3")
# - "<major>.<minor>.<patch>" (e.g., "1.2.3")
#
# The version will be used by later steps to fill in the value for the
# "version" key required for a valid module manifest.
- name: Extract Version From Tag
id: get_version
uses: battila7/get-version-action@v2


# Modify "module.json" with values specific to the release.
# Since the values for the "version" and "url" keys aren't known ahead of
# time, the manifest file in the repository is updated with these values.
#
# While this does modify the manifest file in-place, the changes are not
# commited to the repository, and only exist in the action's filesystem.
- name: Modify Module Manifest With Release-Specific Values
id: sub_manifest_link_version
uses: cschleiden/replace-tokens@v1
with:
files: 'module.json'
env:
VERSION: ${{steps.get_version.outputs.version-without-v}}
URL: ${{ env.project_url }}
MANIFEST: ${{ env.latest_manifest_url }}
DOWNLOAD: ${{ env.release_module_url }}


# Create a "module.zip" archive containing all the module's required files.
# If you have other directories or files that will need to be added to
# your packaged module, add them here.
- name: Create Module Archive
run: |
# Note that `zip` will only emit warnings when a file or directory
# doesn't exist, it will not fail.
zip \
`# Options` \
--recurse-paths \
`# The name of the output file` \
./module.zip \
`# The files that will be included.` \
module.json \
README.md \
LICENSE \
templates/ \
scripts/ \
styles/ \
packs/ \
languages/ \
assets/
# Don't forget to add a backslash at the end of the line for any
# additional files or directories!
# Update the GitHub release with the manifest and module archive files.
- name: Update Release With Files
id: create_version_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
name: ${{ github.event.release.name }}
draft: ${{ github.event.release.unpublished }}
prerelease: ${{ github.event.release.prerelease }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: './module.json, ./module.zip'
tag: ${{ github.event.release.tag_name }}
body: ${{ github.event.release.body }}
7 changes: 7 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 0.5.12
Fix terrain wall shadow leakage when walls are in a "V." Closes issue #95, but unfortunately causes the terrain walls to lose their penumbra with sized light sources. See issue #103. This is preferable to shadow leakage because the penumbra is a subtle visual-only effect.

Refactor Settings internal class.
Update Patcher from ATV.
Update geometry lib to 0.2.12.

## 0.5.11
Accepted PR from @Larkinabout that added a resizable circular pixel brush option. Also fixed an error when scene shading was set to none and you toggled the Prone status effect. Thanks @Larkinabout!
Possible compatibility fix for Perceptive module. Issue #81.
Expand Down
13 changes: 6 additions & 7 deletions module.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "elevatedvision",
"minimumCoreVersion": "10",
"id": "elevatedvision",
"title": "Elevated Vision",
"version": "This is auto replaced",
"library": false,
"version": "#{VERSION}#",
"library": "false",
"manifestPlusVersion": "1.0.0",
"compatibility": {
"minimum": "11.299",
"verified": "11.311"
"verified": "11.315"
},
"authors": [
{
Expand Down Expand Up @@ -59,9 +58,9 @@
}
},

"url": "This is auto replaced",
"manifest": "This is auto replaced",
"download": "This is auto replaced",
"url": "#{URL}#",
"manifest": "#{MANIFEST}#",
"download": "#{DOWNLOAD}#",
"license": "LICENSE",
"readme": "README.md"
}
32 changes: 0 additions & 32 deletions scripts/AmbientSound.js

This file was deleted.

24 changes: 12 additions & 12 deletions scripts/ElevationLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
import { testWallsForIntersections } from "./ClockwiseSweepPolygon.js";
import { SCENE_GRAPH } from "./WallTracer.js";
import { FILOQueue } from "./FILOQueue.js";
import { setSceneSetting, getSceneSetting, setSetting, getSetting, SETTINGS } from "./settings.js";
import { setSceneSetting, getSceneSetting, Settings } from "./settings.js";
import { CoordinateElevationCalculator } from "./CoordinateElevationCalculator.js";
import { TokenElevationCalculator } from "./TokenElevationCalculator.js";
import { TravelElevationRay } from "./TravelElevationRay.js";
Expand Down Expand Up @@ -146,7 +146,7 @@ export class ElevationLayer extends InteractionLayer {
*/
drawBrush(data = {}) {
const canvasScale = game?.canvas?.stage?.scale?._x ?? 1.5
const size = getSetting(SETTINGS.BRUSH.SIZE) ?? 100
const size = Settings.get(Settings.KEYS.BRUSH.SIZE) ?? 100
const lineWidth = Math.round(4 - canvasScale)

this.brush.clear();
Expand Down Expand Up @@ -177,13 +177,13 @@ export class ElevationLayer extends InteractionLayer {
if ( !['BracketLeft', 'BracketRight'].includes(event.code) ) return;
if ( !this.brush.visible ) return;

const size = getSetting(SETTINGS.BRUSH.SIZE);
const size = Settings.get(Settings.KEYS.BRUSH.SIZE);
const increment = (event.shiftKey) ? 5 : 1;

if (event.code === 'BracketLeft') {
if (size > SETTINGS.BRUSH.MIN_SIZE) setSetting(SETTINGS.BRUSH.SIZE, size - increment);
if (size > Settings.KEYS.BRUSH.MIN_SIZE) Settings.set(Settings.KEYS.BRUSH.SIZE, size - increment);
} else {
if (size < SETTINGS.BRUSH.MAX_SIZE ) setSetting(SETTINGS.BRUSH.SIZE, size + increment);
if (size < Settings.KEYS.BRUSH.MAX_SIZE ) Settings.set(Settings.KEYS.BRUSH.SIZE, size + increment);
}

this.drawBrush({ visible: true });
Expand Down Expand Up @@ -287,7 +287,7 @@ export class ElevationLayer extends InteractionLayer {
* @type {number}
*/
get elevationStep() {
const step = getSceneSetting(SETTINGS.ELEVATION_INCREMENT);
const step = getSceneSetting(Settings.KEYS.ELEVATION_INCREMENT);
return step ?? canvas.scene.dimensions.distance;
}

Expand All @@ -312,7 +312,7 @@ export class ElevationLayer extends InteractionLayer {
return out || 0;
};

setSceneSetting(SETTINGS.ELEVATION_INCREMENT, stepNew);
setSceneSetting(Settings.KEYS.ELEVATION_INCREMENT, stepNew);
this.changePixelValuesUsingFunction(stepAdjust);
}

Expand All @@ -323,7 +323,7 @@ export class ElevationLayer extends InteractionLayer {
* @type {number}
*/
get elevationMin() {
const min = getSceneSetting(SETTINGS.ELEVATION_MINIMUM);
const min = getSceneSetting(Settings.KEYS.ELEVATION_MINIMUM);
return min ?? 0;
}

Expand All @@ -349,7 +349,7 @@ export class ElevationLayer extends InteractionLayer {
return out || 0; // In case of NaN, etc.
};

setSceneSetting(SETTINGS.ELEVATION_MINIMUM, minNew);
setSceneSetting(Settings.KEYS.ELEVATION_MINIMUM, minNew);
this.changePixelValuesUsingFunction(minAdjust);
}

Expand Down Expand Up @@ -1065,8 +1065,8 @@ export class ElevationLayer extends InteractionLayer {
}

_circleShape(p) {
const brushSize = getSetting(SETTINGS.BRUSH.SIZE);
const r = (brushSize > 1) ? Math.round(getSetting(SETTINGS.BRUSH.SIZE) / 2) : 1;
const brushSize = Settings.get(Settings.KEYS.BRUSH.SIZE);
const r = (brushSize > 1) ? Math.round(Settings.get(Settings.KEYS.BRUSH.SIZE) / 2) : 1;
return new PIXI.Circle(p.x, p.y, r);
}

Expand Down Expand Up @@ -1434,7 +1434,7 @@ export class ElevationLayer extends InteractionLayer {
const p = new PolygonVertex(tlx, tly);
const child = this.setElevationForGridSpace(o, currE, { temporary: true });
this.#temporaryGraphics.set(p.key, child);
}
}
break;
case "fill-by-pixel": {
this.#temporaryGraphics.clear(); // Should be accomplished elsewhere already
Expand Down
6 changes: 3 additions & 3 deletions scripts/LightSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RenderedPointSource
/* eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }] */

import { MODULE_ID, FLAGS } from "./const.js";
import { SETTINGS, getSetting } from "./settings.js";
import { Settings } from "./settings.js";
import { SizedPointSourceShadowWallShader, ShadowMesh } from "./glsl/ShadowWallShader.js";

// Methods related to LightSource
Expand Down Expand Up @@ -57,7 +57,7 @@ function _initialize(wrapped, data) {
wrapped(data);
if ( !this.object ) return;
this.data.lightSize = this.object.document.getFlag(MODULE_ID, FLAGS.LIGHT_SIZE)
?? getSetting(SETTINGS.LIGHTING.LIGHT_SIZE)
?? Settings.get(Settings.KEYS.LIGHTING.LIGHT_SIZE)
?? 0;
}

Expand All @@ -68,7 +68,7 @@ function _initialize(wrapped, data) {
*/
function _getPolygonConfiguration(wrapped) {
const config = wrapped();
if ( getSetting(SETTINGS.LIGHTS_FULL_PENUMBRA) ) config.type = "universal";
if ( Settings.get(Settings.KEYS.LIGHTS_FULL_PENUMBRA) ) config.type = "universal";
return config;
}

Expand Down
Loading

0 comments on commit 44a9420

Please sign in to comment.