Skip to content

Commit b6d5bc1

Browse files
committed
a
1 parent f26e9a8 commit b6d5bc1

14 files changed

+54
-39
lines changed

packs/levels-samples/002384.log

179 KB
Binary file not shown.

packs/levels-samples/CURRENT

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
MANIFEST-002379
1+
MANIFEST-002383

packs/levels-samples/LOG

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
2024/05/30-14:24:29.324 3b48 Recovering log #2377
2-
2024/05/30-14:24:29.328 3b48 Delete type=0 #2377
3-
2024/05/30-14:24:29.328 3b48 Delete type=3 #2375
4-
2024/05/30-14:30:29.858 6724 Level-0 table #2382: started
5-
2024/05/30-14:30:29.858 6724 Level-0 table #2382: 0 bytes OK
6-
2024/05/30-14:30:29.859 6724 Delete type=0 #2380
7-
2024/05/30-14:30:29.860 6724 Manual compaction at level-0 from '!scenes!i1noRqT20RD5stIK' @ 72057594037927935 : 1 .. '!scenes.walls!zksLSgRdh6f8jiUO.z5ptMNOLPqAgK6MH' @ 0 : 0; will stop at (end)
8-
2024/05/30-14:30:29.860 6724 Manual compaction at level-1 from '!scenes!i1noRqT20RD5stIK' @ 72057594037927935 : 1 .. '!scenes.walls!zksLSgRdh6f8jiUO.z5ptMNOLPqAgK6MH' @ 0 : 0; will stop at (end)
1+
2024/05/31-00:19:30.920 660c Recovering log #2381
2+
2024/05/31-00:19:30.924 660c Delete type=0 #2381
3+
2024/05/31-00:19:30.924 660c Delete type=3 #2379

packs/levels-samples/LOG.old

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
2024/05/30-13:28:46.405 4c58 Recovering log #2374
2-
2024/05/30-13:28:46.408 4c58 Delete type=0 #2374
3-
2024/05/30-13:28:46.409 4c58 Delete type=3 #2373
4-
2024/05/30-13:28:53.661 4a68 Level-0 table #2378: started
5-
2024/05/30-13:28:53.661 4a68 Level-0 table #2378: 0 bytes OK
6-
2024/05/30-13:28:53.662 4a68 Delete type=0 #2376
7-
2024/05/30-13:28:53.662 4a68 Manual compaction at level-0 from '!scenes!i1noRqT20RD5stIK' @ 72057594037927935 : 1 .. '!scenes.walls!zksLSgRdh6f8jiUO.z5ptMNOLPqAgK6MH' @ 0 : 0; will stop at (end)
8-
2024/05/30-13:28:53.662 4a68 Manual compaction at level-1 from '!scenes!i1noRqT20RD5stIK' @ 72057594037927935 : 1 .. '!scenes.walls!zksLSgRdh6f8jiUO.z5ptMNOLPqAgK6MH' @ 0 : 0; will stop at (end)
1+
2024/05/30-14:24:29.324 3b48 Recovering log #2377
2+
2024/05/30-14:24:29.328 3b48 Delete type=0 #2377
3+
2024/05/30-14:24:29.328 3b48 Delete type=3 #2375
4+
2024/05/30-14:30:29.858 6724 Level-0 table #2382: started
5+
2024/05/30-14:30:29.858 6724 Level-0 table #2382: 0 bytes OK
6+
2024/05/30-14:30:29.859 6724 Delete type=0 #2380
7+
2024/05/30-14:30:29.860 6724 Manual compaction at level-0 from '!scenes!i1noRqT20RD5stIK' @ 72057594037927935 : 1 .. '!scenes.walls!zksLSgRdh6f8jiUO.z5ptMNOLPqAgK6MH' @ 0 : 0; will stop at (end)
8+
2024/05/30-14:30:29.860 6724 Manual compaction at level-1 from '!scenes!i1noRqT20RD5stIK' @ 72057594037927935 : 1 .. '!scenes.walls!zksLSgRdh6f8jiUO.z5ptMNOLPqAgK6MH' @ 0 : 0; will stop at (end)
Binary file not shown.

packs/macros/002379.log

Whitespace-only changes.
File renamed without changes.

packs/macros/CURRENT

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
MANIFEST-002377
1+
MANIFEST-002381

packs/macros/LOG

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
2024/05/30-14:24:29.318 4760 Recovering log #2375
2-
2024/05/30-14:24:29.322 4760 Delete type=0 #2375
3-
2024/05/30-14:24:29.322 4760 Delete type=3 #2373
4-
2024/05/30-14:30:29.853 6724 Level-0 table #2380: started
5-
2024/05/30-14:30:29.853 6724 Level-0 table #2380: 0 bytes OK
6-
2024/05/30-14:30:29.854 6724 Delete type=0 #2378
7-
2024/05/30-14:30:29.855 6724 Manual compaction at level-0 from '!macros!2LfY4Ky5rRDkK7h8' @ 72057594037927935 : 1 .. '!macros!yx7Eb76rfzjh0LEO' @ 0 : 0; will stop at (end)
8-
2024/05/30-14:30:29.855 6724 Manual compaction at level-1 from '!macros!2LfY4Ky5rRDkK7h8' @ 72057594037927935 : 1 .. '!macros!yx7Eb76rfzjh0LEO' @ 0 : 0; will stop at (end)
1+
2024/05/31-00:19:30.910 812c Recovering log #2379
2+
2024/05/31-00:19:30.914 812c Delete type=0 #2379
3+
2024/05/31-00:19:30.914 812c Delete type=3 #2377

packs/macros/LOG.old

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
2024/05/30-13:28:46.397 f2c Recovering log #2372
2-
2024/05/30-13:28:46.400 f2c Delete type=0 #2372
3-
2024/05/30-13:28:46.400 f2c Delete type=3 #2371
4-
2024/05/30-13:28:53.658 4a68 Level-0 table #2376: started
5-
2024/05/30-13:28:53.658 4a68 Level-0 table #2376: 0 bytes OK
6-
2024/05/30-13:28:53.659 4a68 Delete type=0 #2374
7-
2024/05/30-13:28:53.659 4a68 Manual compaction at level-0 from '!macros!2LfY4Ky5rRDkK7h8' @ 72057594037927935 : 1 .. '!macros!yx7Eb76rfzjh0LEO' @ 0 : 0; will stop at (end)
8-
2024/05/30-13:28:53.659 4a68 Manual compaction at level-1 from '!macros!2LfY4Ky5rRDkK7h8' @ 72057594037927935 : 1 .. '!macros!yx7Eb76rfzjh0LEO' @ 0 : 0; will stop at (end)
1+
2024/05/30-14:24:29.318 4760 Recovering log #2375
2+
2024/05/30-14:24:29.322 4760 Delete type=0 #2375
3+
2024/05/30-14:24:29.322 4760 Delete type=3 #2373
4+
2024/05/30-14:30:29.853 6724 Level-0 table #2380: started
5+
2024/05/30-14:30:29.853 6724 Level-0 table #2380: 0 bytes OK
6+
2024/05/30-14:30:29.854 6724 Delete type=0 #2378
7+
2024/05/30-14:30:29.855 6724 Manual compaction at level-0 from '!macros!2LfY4Ky5rRDkK7h8' @ 72057594037927935 : 1 .. '!macros!yx7Eb76rfzjh0LEO' @ 0 : 0; will stop at (end)
8+
2024/05/30-14:30:29.855 6724 Manual compaction at level-1 from '!macros!2LfY4Ky5rRDkK7h8' @ 72057594037927935 : 1 .. '!macros!yx7Eb76rfzjh0LEO' @ 0 : 0; will stop at (end)
Binary file not shown.

scripts/config.js

-3
Original file line numberDiff line numberDiff line change
@@ -364,16 +364,13 @@ Hooks.on("renderTileConfig", (app, html, data) => {
364364
},
365365
});
366366
injHtml.find(`input[name="flags.${CONFIG.Levels.MODULE_ID}.rangeTop"]`).closest(".form-group").before(`
367-
<p class="notes" style="color: red" id="no-overhead-warning">${game.i18n.localize("levels.tileconfig.noOverhead")}</>
368367
<p class="notes" style="color: red" id="occlusion-none-warning">${game.i18n.localize("levels.tileconfig.occlusionNone")}</>
369368
`);
370369
html.on("change", "input", (e) => {
371-
const isOverhead = html.find(`input[name="overhead"]`).is(":checked");
372370
const occlusionMode = html.find(`select[name="occlusion.mode"]`).val();
373371
const isShowIfAbove = injHtml.find(`input[name="flags.levels.showIfAbove"]`).is(":checked");
374372
injHtml.find("input").prop("disabled", !isOverhead);
375373
injHtml.find("input[name='flags.levels.showAboveRange']").closest(".form-group").toggle(isShowIfAbove);
376-
html.find("#no-overhead-warning").toggle(!isOverhead);
377374
html.find("#occlusion-none-warning").toggle(occlusionMode == 0);
378375
app.setPosition({ height: "auto" });
379376
});

scripts/handlers/lightHandler.js

+28
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,32 @@ export class LightHandler{
2626
}
2727
return result && isLightVisible;
2828
}
29+
30+
static _isLightSourceDisabled(wrapped, ...args) {
31+
const result = wrapped(...args);
32+
const isPreview = this.document?.id == null;
33+
if(isPreview) return result;
34+
if(!CONFIG.Levels.handlers.UIHandler.emitsLightUI(this)) return true;
35+
if (game.Levels3DPreview?._active) return result;
36+
const isToken = this instanceof Token;
37+
const rangeBottom = this.document.elevation ?? -Infinity;
38+
const rangeTop = isToken ? this.losHeight : this.document.flags.levels?.rangeTop ?? Infinity;
39+
const currentElevation = CONFIG.Levels.currentToken?.losHeight
40+
if(currentElevation === undefined) return result;
41+
const underBackground = currentElevation >= canvas.primary.background.elevation && rangeTop < canvas.primary.background.elevation;
42+
if(underBackground) return true;
43+
let isLightVisible = false;
44+
if ((canvas.scene.flags.levels?.lightMasking ?? true)) {
45+
if (isToken) isLightVisible = true;//this.visible || rangeBottom <= currentElevation;
46+
else isLightVisible = rangeBottom <= currentElevation;
47+
} else {
48+
let inTokenElevationRange = false;
49+
if (isToken) {
50+
const currentTokenElevation = CONFIG.Levels.currentToken?.document?.elevation ?? currentElevation;
51+
inTokenElevationRange = rangeBottom <= currentTokenElevation && currentTokenElevation <= rangeTop;
52+
}
53+
isLightVisible = (rangeBottom <= currentElevation && currentElevation <= rangeTop) || inTokenElevationRange;
54+
}
55+
return result || !isLightVisible;
56+
}
2957
}

scripts/wrappers.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ export function registerWrappers() {
119119

120120
libWrapper.register(LevelsConfig.MODULE_ID, "ClockwiseSweepPolygon.prototype._testCollision", LevelsConfig.handlers.SightHandler._testCollision, "MIXED");
121121

122-
libWrapper.register(LevelsConfig.MODULE_ID, "CONFIG.AmbientLight.objectClass.prototype.emitsLight", LevelsConfig.handlers.LightHandler.isLightVisibleWrapper, "WRAPPER");
122+
libWrapper.register(LevelsConfig.MODULE_ID, "CONFIG.AmbientLight.objectClass.prototype._isLightSourceDisabled", LevelsConfig.handlers.LightHandler._isLightSourceDisabled, "WRAPPER");
123123

124-
libWrapper.register(LevelsConfig.MODULE_ID, "CONFIG.Token.objectClass.prototype.emitsLight", LevelsConfig.handlers.LightHandler.isLightVisibleWrapper, "WRAPPER");
124+
libWrapper.register(LevelsConfig.MODULE_ID, "CONFIG.Token.objectClass.prototype._isLightSource", LevelsConfig.handlers.LightHandler.isLightVisibleWrapper, "WRAPPER");
125125

126126
libWrapper.register(LevelsConfig.MODULE_ID, "CONFIG.AmbientSound.objectClass.prototype.isAudible", LevelsConfig.handlers.SoundHandler.isAudible, "WRAPPER");
127127

0 commit comments

Comments
 (0)