Add a new tile, the one-way thin wall
This commit is contained in:
parent
fa06eb8d7a
commit
5384561413
@ -1906,6 +1906,7 @@ const EDITOR_PALETTE = [{
|
|||||||
'sokoban_block/yellow',
|
'sokoban_block/yellow',
|
||||||
'sokoban_button/yellow',
|
'sokoban_button/yellow',
|
||||||
'sokoban_wall/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_block/green': { name: 'sokoban_block', color: 'green' },
|
||||||
'sokoban_button/green': { name: 'sokoban_button', color: 'green' },
|
'sokoban_button/green': { name: 'sokoban_button', color: 'green' },
|
||||||
'sokoban_wall/green': { name: 'sokoban_wall', 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_LEFT = [3, 0, 1, 2, 5, 4];
|
||||||
const _RAILROAD_ROTATED_RIGHT = [1, 2, 3, 0, 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');
|
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
|
// Fill in some special behavior that boils down to rotating tiles which happen to be encoded as
|
||||||
// different tile types
|
// different tile types
|
||||||
|
|||||||
@ -1154,6 +1154,11 @@ export const LL_TILESET_LAYOUT = {
|
|||||||
thin_walls_ns: [8, 4],
|
thin_walls_ns: [8, 4],
|
||||||
thin_walls_ew: [8, 5],
|
thin_walls_ew: [8, 5],
|
||||||
},
|
},
|
||||||
|
one_way_walls: {
|
||||||
|
__special__: 'thin_walls',
|
||||||
|
thin_walls_ns: [9, 4],
|
||||||
|
thin_walls_ew: [9, 5],
|
||||||
|
},
|
||||||
|
|
||||||
force_floor_n: {
|
force_floor_n: {
|
||||||
__special__: 'scroll',
|
__special__: 'scroll',
|
||||||
|
|||||||
@ -376,10 +376,27 @@ const TILE_TYPES = {
|
|||||||
thin_walls: {
|
thin_walls: {
|
||||||
layer: LAYERS.thin_wall,
|
layer: LAYERS.thin_wall,
|
||||||
blocks(me, level, actor, direction) {
|
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) {
|
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) {
|
populate_defaults(me) {
|
||||||
me.edges = 0; // bitmask of directions
|
me.edges = 0; // bitmask of directions
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user