Skip to content

Commit

Permalink
Merge branch 'hotfix/413' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	src/components/ui/tabs/Tabs.tsx
#	src/components/world/Connections.tsx
#	src/lib/compiler/compileData.ts
#	src/store/features/console/consoleMiddleware.ts
  • Loading branch information
chrismaltby committed Sep 16, 2024
2 parents 8617309 + 76e92a7 commit 113f8a7
Show file tree
Hide file tree
Showing 8 changed files with 377 additions and 282 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Optimised performance of "Show Connections" calculations by moving most of the effort to a thottled Worker thread. This also improves script editing performance when Connections are visible.
- "Switch" event updated to allow use of constant values for each branch condition

## [4.1.3] - 2024-09-16

### Changed

- Updated Spanish localisation. [@doomer6699](https://github.com/doomer6699)
- Improved error message that appears when project fails to open due to broken plugins

### Fixed

- Fix issue where adding a new song wouldn't warn about unsaved changes in current song
Expand Down
513 changes: 288 additions & 225 deletions contributors.json

Large diffs are not rendered by default.

29 changes: 18 additions & 11 deletions patrons.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@
},
{
"attributes": {
"full_name": "Gumpy Function"
"full_name": "Goosifer"
},
"id": "93658267",
"id": "2840872",
"type": "user"
},
{
"attributes": {
"full_name": "Justin Kocian"
"full_name": "Gumpy Function"
},
"id": "59293884",
"id": "93658267",
"type": "user"
},
{
Expand Down Expand Up @@ -113,13 +113,6 @@
},
"id": "14825686",
"type": "user"
},
{
"attributes": {
"full_name": "The Judge"
},
"id": "111003767",
"type": "user"
}
],
"pastPatrons": [
Expand All @@ -137,6 +130,13 @@
"id": "128473778",
"type": "user"
},
{
"attributes": {
"full_name": "Justin Kocian"
},
"id": "59293884",
"type": "user"
},
{
"attributes": {
"full_name": "Martin Gauer"
Expand All @@ -158,6 +158,13 @@
"id": "57539298",
"type": "user"
},
{
"attributes": {
"full_name": "The Judge"
},
"id": "111003767",
"type": "user"
},
{
"attributes": {
"full_name": "TweakerInc"
Expand Down
62 changes: 32 additions & 30 deletions src/lang/es.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions src/lib/compiler/compileData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -973,14 +973,6 @@ export const precompileScenes = (
(!scene.tilesetId || background.commonTilesetId === scene.tilesetId)
);

if (!backgroundWithCommonTileset) {
warnings(
`Error in scene '${scene.symbol}' : ${
scene.name ? `'${scene.name}'` : ""
} includes a common tileset that can't be located.`
);
}

const background =
backgroundWithCommonTileset ??
usedBackgrounds.find(
Expand All @@ -995,6 +987,14 @@ export const precompileScenes = (
);
}

if (!backgroundWithCommonTileset) {
warnings(
`Error in scene '${scene.symbol}' : ${
scene.name ? `'${scene.name}'` : ""
} includes a common tileset that can't be located.`
);
}

const usedSpritesLookup = keyBy(usedSprites, "id");

if (scene.actors.length > MAX_ACTORS) {
Expand Down
13 changes: 12 additions & 1 deletion src/lib/project/loadScriptEventHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,18 @@ const loadScriptEventHandler = async (
path: string
): Promise<ScriptEventHandler> => {
const handlerCode = await readFile(path, "utf8");
const handler = vm.run(handlerCode) as ScriptEventHandler;

let handler: ScriptEventHandler;
try {
handler = vm.run(handlerCode) as ScriptEventHandler;
} catch (error) {
throw new Error(
`Failed to load script event handler at ${path}: ${
(error as Error).message
}`
);
}

if (!handler.id) {
throw new Error(`Event handler ${path} is missing id`);
}
Expand Down
8 changes: 6 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,12 @@ ipcMain.handle("app:show-project-window", () => {
});

ipcMain.handle("project:open", async (_event, arg) => {
const { projectPath } = arg;
return openProject(projectPath);
try {
const { projectPath } = arg;
return await openProject(projectPath);
} catch (e) {
dialog.showErrorBox(l10n("ERROR_TITLE"), String(e));
}
});

ipcMain.handle("project:open-project-picker", async (_event, _arg) => {
Expand Down
11 changes: 6 additions & 5 deletions src/store/features/console/consoleMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const getLinkToSymbol = (
}

const scene = allScenes.find((s) => {
return symbol.startsWith(s.symbol);
return symbol.startsWith(`${s.symbol}_`) || symbol === s.symbol;
});

if (scene) {
Expand Down Expand Up @@ -135,10 +135,11 @@ const consoleMiddleware: Middleware<Dispatch, RootState> =
});
}
}
} else if (action.payload.text.startsWith("Error in scene")) {
const symbol = action.payload.text.match(
/Error in scene '([^']*)'/
)?.[1];
} else if (
action.payload.text.startsWith("Error") &&
action.payload.text.includes("scene '")
) {
const symbol = action.payload.text.match(/scene '([^']*)'/)?.[1];
if (symbol) {
const state = store.getState();
const link = getLinkToSymbol(symbol, state);
Expand Down

0 comments on commit 113f8a7

Please sign in to comment.