Skip to content

@v12-engine/editor/vite ​

Core ​

What a game meets first.

NameKindWhat
editorFilesfunctionThe plugin: plugins: [editorFiles()] in vite.config.ts. A project laid out another way than this repository says how (EditorFilesOptions): editorFiles({ games: 'games', public: 'static' }), or editorFiles({ gameFolder: () => 'src/game' }) for a project that is one game

Advanced ​

Interfaces ​

NameWhat
EditorFilesOptions betaWhat editorFiles is told of a project's layout. Paths are from the root of the project
FileAnswer betaWhat the editor's file handler answers to a request: a status, a body and headers
MapFiles betaWhat the engine says a map file is: how to read one, and how to write it and its names. Handed in, not imported: the config of the dev server loads this file, and the engine is loaded by the dev server once it runs
ProjectLayout betaA project's layout, worked out: every path whole

Functions ​

NameWhat
answer betaAnswers what the editor asks, for a project at root (or laid out as ProjectLayout says). request is what comes after /__editor/: GET ping is { editor: true }, that there is a project here; the rest is of a game (game=td), but for GET project, what the project is (projectFacts); its maps (maps, map-facts, map, map-version, map-files), prefabs (prefabs, prefab), scenarios, tuning, data, looks, its own files (game-files), its code shown read only (code), new code from a template (scaffold) and where it defines something (source), each as its entry in the routes of this file says. What is asked of nothing there is 404; a method a thing has not, 405. The project's scripts (run) are not here: the plugin alone answers them, on a dev server (runScripts.ts)
definitionOf betaWhere something of the code is defined, by its id: the first id: '<id>' in the game's folder, then in the other games and the engine, then in the rest of the project's code (the scenes of its app). Definitions are plain objects that do not know where they were written, so the code is searched. key is another property to look for: check: for the game's checks
mapVersion betaThe version of a map file: a hash of what is in it. The editor is given it with the map, and sends it back as it saves: a file that changed since (a teammate's work, after a pull) is not written over without asking (S25)

Types ​

NameWhat
ScaffoldKind betaWhat a stub is of (editor.code.newWithCode)