Skip to content

Commit 32f30a1

Browse files
committed
a
1 parent 484dbf5 commit 32f30a1

File tree

13 files changed

+53
-45
lines changed

13 files changed

+53
-45
lines changed
File renamed without changes.

packs/levels-samples/CURRENT

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
MANIFEST-003256
1+
MANIFEST-003268

packs/levels-samples/LOG

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
2024/10/13-22:32:18.378 1bf4 Recovering log #3254
2-
2024/10/13-22:32:18.381 1bf4 Delete type=0 #3254
3-
2024/10/13-22:32:18.381 1bf4 Delete type=3 #3252
1+
2024/10/14-14:33:38.434 40b4 Recovering log #3266
2+
2024/10/14-14:33:38.438 40b4 Delete type=0 #3266
3+
2024/10/14-14:33:38.438 40b4 Delete type=3 #3264

packs/levels-samples/LOG.old

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
2024/10/13-21:52:43.379 6f68 Recovering log #3251
2-
2024/10/13-21:52:43.382 6f68 Delete type=0 #3251
3-
2024/10/13-21:52:43.382 6f68 Delete type=3 #3250
4-
2024/10/13-22:32:13.661 74cc Level-0 table #3255: started
5-
2024/10/13-22:32:13.661 74cc Level-0 table #3255: 0 bytes OK
6-
2024/10/13-22:32:13.663 74cc Delete type=0 #3253
7-
2024/10/13-22:32:13.667 74cc Manual compaction at level-0 from '!scenes!i1noRqT20RD5stIK' @ 72057594037927935 : 1 .. '!scenes.walls!zksLSgRdh6f8jiUO.z5ptMNOLPqAgK6MH' @ 0 : 0; will stop at (end)
8-
2024/10/13-22:32:13.667 74cc Manual compaction at level-1 from '!scenes!i1noRqT20RD5stIK' @ 72057594037927935 : 1 .. '!scenes.walls!zksLSgRdh6f8jiUO.z5ptMNOLPqAgK6MH' @ 0 : 0; will stop at (end)
1+
2024/10/14-14:31:44.523 40b4 Recovering log #3263
2+
2024/10/14-14:31:44.526 40b4 Delete type=0 #3263
3+
2024/10/14-14:31:44.526 40b4 Delete type=3 #3262
4+
2024/10/14-14:32:47.498 475c Level-0 table #3267: started
5+
2024/10/14-14:32:47.498 475c Level-0 table #3267: 0 bytes OK
6+
2024/10/14-14:32:47.499 475c Delete type=0 #3265
7+
2024/10/14-14:32:47.502 475c Manual compaction at level-0 from '!scenes!i1noRqT20RD5stIK' @ 72057594037927935 : 1 .. '!scenes.walls!zksLSgRdh6f8jiUO.z5ptMNOLPqAgK6MH' @ 0 : 0; will stop at (end)
8+
2024/10/14-14:32:47.502 475c Manual compaction at level-1 from '!scenes!i1noRqT20RD5stIK' @ 72057594037927935 : 1 .. '!scenes.walls!zksLSgRdh6f8jiUO.z5ptMNOLPqAgK6MH' @ 0 : 0; will stop at (end)
Binary file not shown.
File renamed without changes.

packs/macros/CURRENT

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
MANIFEST-003251
1+
MANIFEST-003263

packs/macros/LOG

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
2024/10/13-22:32:18.371 1858 Recovering log #3249
2-
2024/10/13-22:32:18.375 1858 Delete type=0 #3249
3-
2024/10/13-22:32:18.375 1858 Delete type=3 #3247
1+
2024/10/14-14:33:38.428 2b60 Recovering log #3261
2+
2024/10/14-14:33:38.431 2b60 Delete type=0 #3261
3+
2024/10/14-14:33:38.431 2b60 Delete type=3 #3259

packs/macros/LOG.old

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
2024/10/13-21:52:43.371 4d74 Recovering log #3246
2-
2024/10/13-21:52:43.375 4d74 Delete type=0 #3246
3-
2024/10/13-21:52:43.375 4d74 Delete type=3 #3245
4-
2024/10/13-22:32:13.651 74cc Level-0 table #3250: started
5-
2024/10/13-22:32:13.651 74cc Level-0 table #3250: 0 bytes OK
6-
2024/10/13-22:32:13.653 74cc Delete type=0 #3248
7-
2024/10/13-22:32:13.659 74cc Manual compaction at level-0 from '!macros!2LfY4Ky5rRDkK7h8' @ 72057594037927935 : 1 .. '!macros!yx7Eb76rfzjh0LEO' @ 0 : 0; will stop at (end)
8-
2024/10/13-22:32:13.659 74cc Manual compaction at level-1 from '!macros!2LfY4Ky5rRDkK7h8' @ 72057594037927935 : 1 .. '!macros!yx7Eb76rfzjh0LEO' @ 0 : 0; will stop at (end)
1+
2024/10/14-14:31:44.510 2b60 Recovering log #3258
2+
2024/10/14-14:31:44.513 2b60 Delete type=0 #3258
3+
2024/10/14-14:31:44.513 2b60 Delete type=3 #3257
4+
2024/10/14-14:32:47.497 475c Level-0 table #3262: started
5+
2024/10/14-14:32:47.497 475c Level-0 table #3262: 0 bytes OK
6+
2024/10/14-14:32:47.498 475c Delete type=0 #3260
7+
2024/10/14-14:32:47.502 475c Manual compaction at level-0 from '!macros!2LfY4Ky5rRDkK7h8' @ 72057594037927935 : 1 .. '!macros!yx7Eb76rfzjh0LEO' @ 0 : 0; will stop at (end)
8+
2024/10/14-14:32:47.502 475c 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

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {BackgroundHandler} from "./handlers/backgroundHandler.js";
1414
import {RegionHandler} from "./handlers/regionHandler.js";
1515
import { SettingsHandler } from "./handlers/settingsHandler.js";
1616
import { LevelsAPI } from "./API.js";
17-
import { registerWrappers } from "./wrappers.js";
17+
import { registerWrappers, registerSetupWrappers } from "./wrappers.js";
1818
import { inRange, getRangeForDocument, cloneTileMesh, inDistance } from "./helpers.js";
1919
import { setupWarnings } from "./warnings.js";
2020
import {LevelsMigration} from "./migration.js";
@@ -123,6 +123,10 @@ Hooks.on("init", () => {
123123
Hooks.callAll("levelsReady", CONFIG.Levels);
124124
});
125125

126+
Hooks.once("setup", () => {
127+
registerSetupWrappers();
128+
} );
129+
126130
Hooks.once("ready", () => {
127131

128132
if(game.user.isGM && game.settings.get("levels", "migrateOnStartup")) CONFIG.Levels.helpers.migration.migrateAll();

scripts/handlers/sightHandler.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export class SightHandler {
193193
if (config.tests._levels !== object) {
194194
config.tests.length = 0;
195195
for (const p of SightHandler.getTestPoints(object)) {
196-
const elevation = p.z * unitsToPixel;
196+
const elevation = p.z;
197197
config.tests.push({ elevation, point: { x: p.x, y: p.y, z: elevation }, los: new Map() });
198198
}
199199
config.tests._levels = object;
@@ -206,7 +206,7 @@ export class SightHandler {
206206
z = e;
207207
}
208208
z ??= canvas.primary.background.elevation;
209-
z *= unitsToPixel;
209+
//z *= unitsToPixel;
210210
for (const test of config.tests) {
211211
test.point.z = z;
212212
test.elevation = z;

scripts/wrappers.js

+22-18
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,6 @@ export function registerWrappers() {
8787
"MIXED",
8888
);
8989

90-
const visibilityTestObjectStack = [];
91-
libWrapper.register(
92-
LevelsConfig.MODULE_ID,
93-
"CanvasVisibility.prototype.testVisibility",
94-
function visibilityWrapper(wrapped, ...args) {
95-
const options = (args[1] ??= {});
96-
if (options.object instanceof Token) options.tolerance = 0;
97-
visibilityTestObjectStack.push(LevelsConfig.visibilityTestObject);
98-
LevelsConfig.visibilityTestObject = args[1].object;
99-
const res = wrapped(...args);
100-
LevelsConfig.visibilityTestObject = visibilityTestObjectStack.pop();
101-
return !!res;
102-
},
103-
"WRAPPER",
104-
);
105-
106-
libWrapper.register(LevelsConfig.MODULE_ID, "CanvasVisibility.prototype._createVisibilityTestConfig", LevelsConfig.handlers.SightHandler._createVisibilityTestConfig, "OVERRIDE", { perf_mode: "FAST" });
107-
10890
libWrapper.register(LevelsConfig.MODULE_ID, "DetectionMode.prototype._testRange", LevelsConfig.handlers.SightHandler._testRange, "OVERRIDE", { perf_mode: "FAST" });
10991

11092
libWrapper.register(LevelsConfig.MODULE_ID, "ClockwiseSweepPolygon.prototype.contains", LevelsConfig.handlers.SightHandler.containsWrapper, "MIXED");
@@ -121,3 +103,25 @@ export function registerWrappers() {
121103

122104
libWrapper.register(LevelsConfig.MODULE_ID, "CONFIG.Token.objectClass.prototype.isVisible", LevelsConfig.handlers.UIHandler.tokenUIWrapperIsVisible, "WRAPPER");
123105
}
106+
107+
export function registerSetupWrappers() {
108+
const LevelsConfig = CONFIG.Levels;
109+
110+
const visibilityTestObjectStack = [];
111+
libWrapper.register(
112+
LevelsConfig.MODULE_ID,
113+
"CONFIG.Canvas.groups.visibility.groupClass.prototype.testVisibility",
114+
function visibilityWrapper(wrapped, ...args) {
115+
const options = (args[1] ??= {});
116+
if (options.object instanceof Token) options.tolerance = 0;
117+
visibilityTestObjectStack.push(LevelsConfig.visibilityTestObject);
118+
LevelsConfig.visibilityTestObject = args[1].object;
119+
const res = wrapped(...args);
120+
LevelsConfig.visibilityTestObject = visibilityTestObjectStack.pop();
121+
return !!res;
122+
},
123+
"WRAPPER",
124+
);
125+
126+
libWrapper.register(LevelsConfig.MODULE_ID, "CONFIG.Canvas.groups.visibility.groupClass.prototype._createVisibilityTestConfig", LevelsConfig.handlers.SightHandler._createVisibilityTestConfig, "OVERRIDE", { perf_mode: "FAST" });
127+
}

0 commit comments

Comments
 (0)