Skip to content

Commit

Permalink
Rename engine.json 'types' array to 'sceneTypes'
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismaltby committed Apr 6, 2024
1 parent 8ae80c9 commit 7191c0d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add 'Color Only' mode. Roughly doubles the amount of tiles available for backgrounds and sprites though game will no longer run on original GB (DMG) hardware
- Add event "Replace Tile At Position" and "Replace Tile From Sequence" to update background tiles, calling "Replace Tile From Sequence" repeatedly will cycle through animation frames
- Add new asset folder "Tilesets" for use in "Replace Tile" events
- Add ability for plugins to define additional scene types by including defined types (e.g. `"types": [{"key": "RACING", "label": "Racing 2D"}]`) in `engine.json` [@pau-tomas](https://github.com/pau-tomas)
- Add ability for plugins to define additional scene types by including defined types (e.g. `"sceneTypes": [{"key": "RACING", "label": "Racing 2D"}]`) in `engine.json` [@pau-tomas](https://github.com/pau-tomas)

### Changed

Expand Down
2 changes: 1 addition & 1 deletion appData/src/gb/engine.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
"defaultValue": 0
}
],
"types": [
"sceneTypes": [
{
"key": "TOPDOWN",
"label": "GAMETYPE_TOP_DOWN"
Expand Down
20 changes: 10 additions & 10 deletions src/lib/project/sceneTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { engineRoot } from "consts";
import glob from "glob";

interface EngineData {
types?: SceneTypeSchema[];
sceneTypes?: SceneTypeSchema[];
}

export interface SceneTypeSyncResult {
types: SceneTypeSchema[];
sceneTypes: SceneTypeSchema[];
}

export const sceneTypesEmitter = new EventEmitter.EventEmitter();
Expand All @@ -36,12 +36,12 @@ export const loadSceneTypes = async (
defaultEngine = await readJSON(defaultEngineJsonPath);
}

let types: SceneTypeSchema[] = [];
let sceneTypes: SceneTypeSchema[] = [];

if (localEngine && localEngine.types) {
types = localEngine.types;
} else if (defaultEngine && defaultEngine.types) {
types = defaultEngine.types;
if (localEngine && localEngine.sceneTypes) {
sceneTypes = localEngine.sceneTypes;
} else if (defaultEngine && defaultEngine.sceneTypes) {
sceneTypes = defaultEngine.sceneTypes;
}

const enginePlugins = glob.sync(`${pluginsPath}/*/engine`);
Expand All @@ -50,14 +50,14 @@ export const loadSceneTypes = async (
if (await pathExists(enginePluginJsonPath)) {
try {
const pluginEngine = await readJSON(enginePluginJsonPath);
if (pluginEngine.types) {
types = types.concat(pluginEngine.types);
if (pluginEngine.sceneTypes) {
sceneTypes = sceneTypes.concat(pluginEngine.sceneTypes);
}
} catch (e) {
console.warn(e);
}
}
}

return types;
return sceneTypes;
};

0 comments on commit 7191c0d

Please sign in to comment.