Skip to content

Commit 1ab593a

Browse files
authored
Merge pull request #543 from Gen1xLol/main
fix past me's stupid oversight on the lighting ext (THIS IS THE LAST ONE I SWEAR)
2 parents c6dd14b + c7faff2 commit 1ab593a

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

static/extensions/Gen1x/lighting.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,7 @@ self.onmessage = ({ data: msg }) => {
11941194
if (Scratch.Cast.toString(raw) === '_myself_') {
11951195
const editingTarget = Scratch.vm.editingTarget;
11961196
if (editingTarget && !editingTarget.isStage) return editingTarget.sprite.name;
1197+
11971198
return null;
11981199
}
11991200
return Scratch.Cast.toString(raw);
@@ -1349,6 +1350,7 @@ self.onmessage = ({ data: msg }) => {
13491350
const li = this.lights[lightId];
13501351
if (!li) return false;
13511352

1353+
13521354
let spriteName = Scratch.Cast.toString(args.SPRITE);
13531355
if (spriteName === '_myself_') {
13541356
const t = util && util.target ? util.target : Scratch.vm.editingTarget;
@@ -1379,6 +1381,7 @@ self.onmessage = ({ data: msg }) => {
13791381
const dist = Math.sqrt(dx * dx + dy * dy);
13801382
if (dist >= li.radius) return false;
13811383
const angle = Math.atan2(dy, dx);
1384+
13821385
const dirRad = (90 - li.direction) * (Math.PI / 180);
13831386
let delta = Math.abs(((angle - dirRad + Math.PI) % (2 * Math.PI)) - Math.PI);
13841387
return delta <= li.arc * (Math.PI / 180);
@@ -1463,9 +1466,9 @@ self.onmessage = ({ data: msg }) => {
14631466
const cam = this._getCameraState();
14641467
if (cam) {
14651468
globalCamX = cam.pos[0];
1466-
globalCamY = cam.pos[1];
1467-
globalCamScale = cam.scale || 1;
1468-
globalCamDirRad = cam.dir * (Math.PI / 180);
1469+
globalCamY = -cam.pos[1];
1470+
globalCamScale = 1 / (cam.scale || 1);
1471+
globalCamDirRad = -cam.dir * (Math.PI / 180);
14691472
}
14701473
}
14711474

@@ -1490,9 +1493,9 @@ self.onmessage = ({ data: msg }) => {
14901493
const cam = _resolveCamera(li.cameraOverride);
14911494
if (cam) {
14921495
camX = cam.pos[0];
1493-
camY = cam.pos[1];
1494-
camScale = cam.scale || 1;
1495-
camDirRad = cam.dir * (Math.PI / 180);
1496+
camY = -cam.pos[1];
1497+
camScale = 1 / (cam.scale || 1);
1498+
camDirRad = -cam.dir * (Math.PI / 180);
14961499
} else {
14971500
camX = 0; camY = 0; camScale = 1; camDirRad = 0;
14981501
}

0 commit comments

Comments
 (0)