diff --git a/js/main-editor.js b/js/main-editor.js index 48aa342..f530883 100644 --- a/js/main-editor.js +++ b/js/main-editor.js @@ -1906,6 +1906,7 @@ const EDITOR_PALETTE = [{ 'sokoban_block/yellow', 'sokoban_button/yellow', 'sokoban_wall/yellow', + 'one_way_walls/south', ], }]; @@ -2584,6 +2585,7 @@ const SPECIAL_PALETTE_ENTRIES = { 'sokoban_block/green': { name: 'sokoban_block', color: 'green' }, 'sokoban_button/green': { name: 'sokoban_button', color: 'green' }, 'sokoban_wall/green': { name: 'sokoban_wall', color: 'green' }, + 'one_way_walls/south': { name: 'one_way_walls', edges: DIRECTIONS['south'].bit }, }; const _RAILROAD_ROTATED_LEFT = [3, 0, 1, 2, 5, 4]; const _RAILROAD_ROTATED_RIGHT = [1, 2, 3, 0, 5, 4]; @@ -2815,6 +2817,15 @@ const SPECIAL_PALETTE_BEHAVIOR = { return 'sokoban_wall/' + (tile.color ?? 'red'); }, }, + one_way_walls: { + pick_palette_entry(tile) { + return 'one_way_walls/south'; + }, + }, +}; +SPECIAL_PALETTE_BEHAVIOR['one_way_walls'] = { + ...SPECIAL_PALETTE_BEHAVIOR['thin_walls'], + ...SPECIAL_PALETTE_BEHAVIOR['one_way_walls'], }; // Fill in some special behavior that boils down to rotating tiles which happen to be encoded as // different tile types diff --git a/js/tileset.js b/js/tileset.js index 113b3c0..0c7bf0f 100644 --- a/js/tileset.js +++ b/js/tileset.js @@ -1154,6 +1154,11 @@ export const LL_TILESET_LAYOUT = { thin_walls_ns: [8, 4], thin_walls_ew: [8, 5], }, + one_way_walls: { + __special__: 'thin_walls', + thin_walls_ns: [9, 4], + thin_walls_ew: [9, 5], + }, force_floor_n: { __special__: 'scroll', diff --git a/js/tiletypes.js b/js/tiletypes.js index 1dd0f6f..24540f4 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -376,10 +376,27 @@ const TILE_TYPES = { thin_walls: { layer: LAYERS.thin_wall, blocks(me, level, actor, direction) { - return ((me.edges & DIRECTIONS[direction].opposite_bit) !== 0) && actor.type.name !== 'ghost'; + if (actor.type.name === 'ghost') + return false; + return (me.edges & DIRECTIONS[direction].opposite_bit) !== 0; }, blocks_leaving(me, actor, direction) { - return ((me.edges & DIRECTIONS[direction].bit) !== 0) && actor.type.name !== 'ghost'; + if (actor.type.name === 'ghost') + return false; + return (me.edges & DIRECTIONS[direction].bit) !== 0; + }, + populate_defaults(me) { + me.edges = 0; // bitmask of directions + }, + }, + // These only support one-way into the tile, so they're pretty much thin walls that can only + // stop something from leaving + one_way_walls: { + layer: LAYERS.thin_wall, + blocks_leaving(me, actor, direction) { + if (actor.type.name === 'ghost') + return false; + return (me.edges & DIRECTIONS[direction].bit) !== 0; }, populate_defaults(me) { me.edges = 0; // bitmask of directions