diff --git a/js/main-editor.js b/js/main-editor.js index 05e4110..0b485a0 100644 --- a/js/main-editor.js +++ b/js/main-editor.js @@ -766,11 +766,20 @@ export class Editor extends PrimaryView { } } + is_in_level(x, y) { + return 0 <= x && x < this.stored_level.size_x && 0 <= y && y < this.stored_level.size_y; + } + place_in_cell(x, y, name) { // TODO weird api? if (! name) return; + // TODO seems like a big problem to silently ignore, but it can happen from mouse + // coordinates while drawing + if (! this.is_in_level(x, y)) + return; + let type = TILE_TYPES[name]; let direction; if (type.is_actor) {