From b2ff27f24187fec5ee22cfa221cdc0e071e6ccc7 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Wed, 9 Dec 2020 20:23:27 -0700 Subject: [PATCH] New LL tile: circuit block, which overrides any wiring below it --- js/main-editor.js | 12 ++++++++++-- js/tileset.js | 5 +++++ js/tiletypes.js | 14 ++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/js/main-editor.js b/js/main-editor.js index 5c05d7b..1202f5e 100644 --- a/js/main-editor.js +++ b/js/main-editor.js @@ -753,9 +753,9 @@ class WireOperation extends DrawOperation { } let cell = this.cell(x, y); - for (let tile of cell) { + for (let tile of Array.from(cell).reverse()) { // TODO probably a better way to do this - if (['floor', 'steel', 'button_pink', 'button_black', 'teleport_blue', 'teleport_red', 'light_switch_on', 'light_switch_off'].indexOf(tile.type.name) < 0) + if (['floor', 'steel', 'button_pink', 'button_black', 'teleport_blue', 'teleport_red', 'light_switch_on', 'light_switch_off', 'circuit_block'].indexOf(tile.type.name) < 0) continue; tile.wire_directions = tile.wire_directions ?? 0; @@ -768,6 +768,7 @@ class WireOperation extends DrawOperation { tile.wire_directions |= DIRECTIONS[wire_direction].bit; } // TODO this.editor.mark_tile_dirty(tile); + break; } prevqx = qx; @@ -1250,6 +1251,7 @@ const EDITOR_PALETTE = [{ 'purple_floor', 'purple_wall', 'button_gray', + 'circuit_block/xxx', ], }]; @@ -1272,6 +1274,7 @@ const SPECIAL_PALETTE_ENTRIES = { 'logic_gate/latch-cw': { name: 'logic_gate', direction: 'north', gate_type: 'latch-cw' }, 'logic_gate/latch-ccw': { name: 'logic_gate', direction: 'north', gate_type: 'latch-ccw' }, 'logic_gate/counter': { name: 'logic_gate', direction: 'north', gate_type: 'counter', memory: 0 }, + 'circuit_block/xxx': { name: 'circuit_block', direction: 'south', wire_directions: 0xf }, }; const _RAILROAD_ROTATED_LEFT = [3, 0, 1, 2, 5, 4]; const _RAILROAD_ROTATED_RIGHT = [1, 2, 3, 0, 5, 4]; @@ -1366,6 +1369,11 @@ const SPECIAL_PALETTE_BEHAVIOR = { } }, }, + circuit_block: { + pick_palette_entry(tile) { + return 'circuit_block/xxx'; + }, + }, }; // 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 4ca68aa..ef96220 100644 --- a/js/tileset.js +++ b/js/tileset.js @@ -851,6 +851,11 @@ export const LL_TILESET_LAYOUT = Object.assign({}, CC2_TILESET_LAYOUT, { // Custom tiles popwall2: [9, 32], bestowal_bow: [10, 32], + circuit_block: { + base: [13, 32], + wired: [11, 32], + wired_cross: [12, 32], + }, // Blob and walker in all four directions blob: { diff --git a/js/tiletypes.js b/js/tiletypes.js index a9acaee..c05e230 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -1537,6 +1537,15 @@ const TILE_TYPES = { level.transmute_tile(me, 'light_switch_off'); }, }, + // LL tile: circuit block, overrides the wiring on the floor below (if any) + circuit_block: { + draw_layer: DRAW_LAYERS.actor, + collision_mask: COLLISION.block_cc2, + blocks_collision: COLLISION.all, + is_actor: true, + is_block: true, + movement_speed: 4, + }, // Time alteration stopwatch_bonus: { @@ -1664,6 +1673,7 @@ const TILE_TYPES = { dirt_block: true, ice_block: true, directional_block: true, + circuit_block: true, }, movement_speed: 4, }, @@ -1979,6 +1989,7 @@ const TILE_TYPES = { dirt_block: true, ice_block: true, directional_block: true, + circuit_block: true, }, infinite_items: { key_green: true, @@ -2000,6 +2011,7 @@ const TILE_TYPES = { dirt_block: true, ice_block: true, directional_block: true, + circuit_block: true, }, infinite_items: { key_yellow: true, @@ -2020,6 +2032,7 @@ const TILE_TYPES = { dirt_block: true, ice_block: true, directional_block: true, + circuit_block: true, }, infinite_items: { key_green: true, @@ -2049,6 +2062,7 @@ const TILE_TYPES = { dirt_block: true, ice_block: true, directional_block: true, + circuit_block: true, }, infinite_items: { key_yellow: true,