diff --git a/js/format-c2g.js b/js/format-c2g.js index a321486..fcfe22a 100644 --- a/js/format-c2g.js +++ b/js/format-c2g.js @@ -791,6 +791,14 @@ const TILE_ENCODING = { name: 'electrified_floor', is_extension: true, }, + 0xd1: { + name: 'hole', + is_extension: true, + }, + 0xd2: { + name: 'cracked_floor', + is_extension: true, + }, 0xe0: { name: 'gift_bow', has_next: true, diff --git a/js/main-editor.js b/js/main-editor.js index 0ca6d33..dfcd3d6 100644 --- a/js/main-editor.js +++ b/js/main-editor.js @@ -1605,6 +1605,8 @@ const EDITOR_PALETTE = [{ 'turntable_cw', 'turntable_ccw', 'electrified_floor', + 'hole', + 'cracked_floor', ], }]; @@ -2207,6 +2209,14 @@ const EDITOR_TILE_DESCRIPTIONS = { name: "Electrified Floor", desc: "Conducts power (like a blue teleporter). While powered, destroys anything not wearing lightning boots (except dirt blocks).", }, + hole: { + name: "Hole", + desc: "A bottomless pit. Destroys everything (except ghosts).", + }, + cracked_floor: { + name: "Cracked Floor", + desc: "Turns into a hole when something steps off of it (except ghosts).", + }, }; const SPECIAL_PALETTE_ENTRIES = { diff --git a/js/main.js b/js/main.js index 482be0f..e35942d 100644 --- a/js/main.js +++ b/js/main.js @@ -97,6 +97,12 @@ const OBITUARIES = { "inadequate insulation", "rode the lightning", ], + fell: [ + "some say she's still falling", + "look before you leap", + "where's my ladder", + "it's dark down here", + ], generic: [ "you had a bad time", ], diff --git a/js/tileset.js b/js/tileset.js index c9e6631..4617093 100644 --- a/js/tileset.js +++ b/js/tileset.js @@ -496,6 +496,7 @@ export const CC2_TILESET_LAYOUT = { burned: [1, 5], exploded: [1, 5], failed: [1, 5], + fell: [5, 39], }, // Do a quick spin I guess?? player1_exit: [[0, 22], [8, 22], [0, 23], [8, 23]], @@ -627,6 +628,7 @@ export const CC2_TILESET_LAYOUT = { burned: [1, 5], exploded: [1, 5], failed: [1, 5], + fell: [5, 39], }, player2_exit: [[0, 27], [8, 27], [0, 28], [8, 28]], fire: [ @@ -1053,6 +1055,12 @@ export const LL_TILESET_LAYOUT = Object.assign({}, CC2_TILESET_LAYOUT, { active: [[5, 41], [6, 41], [7, 41]], inactive: [4, 41], }, + hole: { + __special__: 'visual-state', + north: [8, 41], + open: [9, 41], + }, + cracked_floor: [11, 43], }); export const TILESET_LAYOUTS = { diff --git a/js/tiletypes.js b/js/tiletypes.js index 0a7b07f..ccb3185 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -172,6 +172,9 @@ function player_visual_state(me) { else if (me.fail_reason === 'electrocuted') { return 'burned'; //same gfx for now } + else if (me.fail_reason === 'fell') { + return 'fell'; + } else if (me.fail_reason) { return 'failed'; } @@ -1044,6 +1047,45 @@ const TILE_TYPES = { } }, }, + hole: { + layer: LAYERS.terrain, + on_begin(me, level) { + var one_north = level.cell(me.cell.x, me.cell.y - 1); + if (one_north === null || one_north.get_terrain().type.name != 'hole') { + level._set_tile_prop(me, 'visual_state', 'north'); + } + else { + level._set_tile_prop(me, 'visual_state', 'open'); + } + }, + on_arrive(me, level, other) { + if (other.type.is_real_player) { + level.fail('fell', me, other); + } + else { + level.transmute_tile(other, 'puff'); + } + }, + visual_state(me) { + return (me && me.visual_state) ?? 'open'; + }, + }, + cracked_floor: { + layer: LAYERS.terrain, + on_depart(me, level, other) { + level.spawn_animation(me.cell, 'puff'); + level.transmute_tile(me, 'hole'); + if (other === level.player) { + level.sfx.play_once('popwall', me.cell); + } + //update hole visual state + me.type.on_begin(me, level); + var one_south = level.cell(me.cell.x, me.cell.y + 1); + if (one_south !== null && one_south.get_terrain().type.name == 'hole') { + me.type.on_begin(one_south.get_terrain(), level); + } + }, + }, thief_tools: { layer: LAYERS.terrain, blocks_collision: COLLISION.block_cc1 | COLLISION.monster_solid, @@ -2541,6 +2583,7 @@ const TILE_TYPES = { 'force_floor_n', 'force_floor_s', 'force_floor_e', 'force_floor_w', 'force_floor_all', // Ghosts don't activate swivels or popwalls 'popwall', 'swivel_nw', 'swivel_ne', 'swivel_se', 'swivel_sw', + 'hole', 'cracked_floor', ]), movement_speed: 4, // TODO ignores /most/ walls. collision is basically completely different. has a regular inventory, except red key. good grief diff --git a/tileset-lexy.png b/tileset-lexy.png index b87bf0e..82152a7 100644 Binary files a/tileset-lexy.png and b/tileset-lexy.png differ