From 590ecb36aef805f5a3c7b465ed08327abf5d961b Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Thu, 18 Nov 2021 18:19:57 +1100 Subject: [PATCH 01/10] placing a circuit block on a tile shouldn't crash (fixes #78) --- js/editor/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/editor/main.js b/js/editor/main.js index d60a0ac..65ce985 100644 --- a/js/editor/main.js +++ b/js/editor/main.js @@ -1438,7 +1438,7 @@ export class Editor extends PrimaryView { // Special case: preserve wires when replacing one wired tile with another if (new_tile.type.contains_wire && // FIXME this is hacky garbage - tile === this.fg_tile && this.fg_tile_from_palette) + tile === this.fg_tile && this.fg_tile_from_palette && existing_tile !== undefined) { if (existing_tile.type.contains_wire) { new_tile.wire_directions = existing_tile.wire_directions; From 94a7ec5a2cd40593709ef75d61fbbc1f08b35780 Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Thu, 18 Nov 2021 18:27:28 +1100 Subject: [PATCH 02/10] dropping 2 ankhs in a row shouldn't crash (fixes #79) --- js/tiletypes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/tiletypes.js b/js/tiletypes.js index 8e1be8e..55047d7 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -2952,7 +2952,7 @@ const TILE_TYPES = { { if (level.ankh_tile) { level.transmute_tile(level.ankh_tile, 'floor'); - level.spawn_animation(level.ankh_tile, 'puff'); + level.spawn_animation(level.ankh_tile.cell, 'puff'); } let old_tile = level.ankh_tile; level.ankh_tile = terrain; From 42d543b235a80910973dbafe45fd09a3183ee5be Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Thu, 18 Nov 2021 18:35:06 +1100 Subject: [PATCH 03/10] fix an electric floor visual bug (fixes #80) --- js/tiletypes.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/tiletypes.js b/js/tiletypes.js index 55047d7..9f10185 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -1978,6 +1978,7 @@ const TILE_TYPES = { layer: LAYERS.terrain, wire_propagation_mode: 'all', on_begin(me, level) { + level._set_tile_prop(me, 'is_active', false); level._set_tile_prop(me, 'wire_directions', 15); level.recalculate_circuitry_next_wire_phase = true; }, From 2df4dc582943154ebfd8ae067bf0a613416601cb Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Thu, 18 Nov 2021 18:39:46 +1100 Subject: [PATCH 04/10] fix 'blowing up electric floors doesn't remove the wiring' regression --- js/game.js | 6 ++++++ js/tiletypes.js | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/js/game.js b/js/game.js index 3e69630..f30e1f0 100644 --- a/js/game.js +++ b/js/game.js @@ -2637,6 +2637,7 @@ export class Level extends LevelInterface { return; } + //only used for glass block atm if (actor.type.on_death) { actor.type.on_death(actor, this); } @@ -2804,6 +2805,11 @@ export class Level extends LevelInterface { // to destroy it return; } + + //only used for electrified floor atm + if (tile.type.on_death && !tile.type.is_actor) { + tile.type.on_death(tile, this); + } let old_type = tile.type; let new_type = TILE_TYPES[name]; diff --git a/js/tiletypes.js b/js/tiletypes.js index 9f10185..4303337 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -1278,7 +1278,7 @@ const TILE_TYPES = { return other.cell.get_item() !== null && me.encased_item !== null; }, on_death(me, level) { - //needs to be called by transmute_tile to ttl and by lit_dynamite before remove_tile + //needs to be called by transmute_tile to ttl and by dynamite_lit before remove_tile if (me.encased_item !== null) { level._place_dropped_item(me.encased_item, me.cell ?? me.previous_cell, me); level._set_tile_prop(me, 'encased_item', null); @@ -1995,7 +1995,7 @@ const TILE_TYPES = { level._set_tile_prop(me, 'is_active', false); }, on_death(me, level) { - // FIXME i probably broke this lol + //needs to be called by transmute_tile to ttl and by dynamite_lit before remove_tile //need to remove our wires since they're an implementation detail level._set_tile_prop(me, 'wire_directions', 0); level.recalculate_circuitry_next_wire_phase = true; From d675cddafbb32246656b0b894709c7126af1496a Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Thu, 18 Nov 2021 18:40:15 +1100 Subject: [PATCH 05/10] spaceify --- js/game.js | 12 ++++++------ js/tiletypes.js | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/js/game.js b/js/game.js index f30e1f0..0051977 100644 --- a/js/game.js +++ b/js/game.js @@ -2637,7 +2637,7 @@ export class Level extends LevelInterface { return; } - //only used for glass block atm + //only used for glass block atm if (actor.type.on_death) { actor.type.on_death(actor, this); } @@ -2805,11 +2805,11 @@ export class Level extends LevelInterface { // to destroy it return; } - - //only used for electrified floor atm - if (tile.type.on_death && !tile.type.is_actor) { - tile.type.on_death(tile, this); - } + + //only used for electrified floor atm + if (tile.type.on_death && !tile.type.is_actor) { + tile.type.on_death(tile, this); + } let old_type = tile.type; let new_type = TILE_TYPES[name]; diff --git a/js/tiletypes.js b/js/tiletypes.js index 4303337..1e5b933 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -1978,7 +1978,7 @@ const TILE_TYPES = { layer: LAYERS.terrain, wire_propagation_mode: 'all', on_begin(me, level) { - level._set_tile_prop(me, 'is_active', false); + level._set_tile_prop(me, 'is_active', false); level._set_tile_prop(me, 'wire_directions', 15); level.recalculate_circuitry_next_wire_phase = true; }, From a87db67d841ac6d4a8e717ef0ebbf164e5f988ee Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Thu, 18 Nov 2021 20:22:00 +1100 Subject: [PATCH 06/10] lexy w/ skates and cerise now crack but don't slide on cracked ice (fixes #82) --- js/game.js | 9 ++++----- js/tiletypes.js | 6 ++++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/js/game.js b/js/game.js index 0051977..bd29d9e 100644 --- a/js/game.js +++ b/js/game.js @@ -1881,7 +1881,7 @@ export class Level extends LevelInterface { // Whether we're sliding is determined entirely by whether we most recently moved onto a // sliding tile that we don't ignore. This could /almost/ be computed on the fly, except // that an actor that starts on e.g. ice or a teleporter is not considered sliding. - this._set_tile_prop(actor, 'is_sliding', terrain.type.slide_mode && ! actor.ignores(terrain.type.name)); + this._set_tile_prop(actor, 'is_sliding', terrain.type.slide_mode && !actor.ignores(terrain.type.name) && !actor.slide_ignores(terrain.type.name)); // Do Lexy-style hooking here: only attempt to pull things just after we've actually moved // successfully, which means the hook can never stop us from moving and hook slapping is not @@ -1969,9 +1969,7 @@ export class Level extends LevelInterface { continue; if (actor.ignores(tile.type.name)) continue; - if (actor.slide_ignores(tile.type.name)) - continue; - + if (tile.type.on_approach) { tile.type.on_approach(tile, this, actor); } @@ -2036,7 +2034,8 @@ export class Level extends LevelInterface { continue; } } - else if (tile.type.on_arrive) { + else if (tile.type.on_arrive && !actor.slide_ignores(tile.type.name)) { + // Kind of weird putting slide_ignores here, except that all sliding happens on on_arrive, and tiles that make you slide in on_arrive don't do anything else, so for now it works tile.type.on_arrive(tile, this, actor); } diff --git a/js/tiletypes.js b/js/tiletypes.js index 1e5b933..d38ab81 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -3006,7 +3006,8 @@ const TILE_TYPES = { item_pickup_priority: PICKUP_PRIORITIES.real_player, can_reveal_walls: true, movement_speed: 4, - ignores: new Set(['ice', 'ice_nw', 'ice_ne', 'ice_sw', 'ice_se', 'cracked_ice']), + ignores: new Set(['ice', 'ice_nw', 'ice_ne', 'ice_sw', 'ice_se']), + slide_ignores: new Set(['cracked_ice']), pushes: { dirt_block: true, ice_block: true, @@ -3060,7 +3061,8 @@ const TILE_TYPES = { item_pickup_priority: PICKUP_PRIORITIES.player, can_reveal_walls: true, // XXX i think? movement_speed: 4, - ignores: new Set(['ice', 'ice_nw', 'ice_ne', 'ice_sw', 'ice_se', 'cracked_ice']), + ignores: new Set(['ice', 'ice_nw', 'ice_ne', 'ice_sw', 'ice_se']), + slide_ignores: new Set(['cracked_ice']), pushes: { dirt_block: true, ice_block: true, From 8feb732a8fde50ec6402840be3ba92f901bebf93 Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Thu, 18 Nov 2021 20:53:56 +1100 Subject: [PATCH 07/10] boulders are pushed in the movement not facing direction (fixes #81) --- js/game.js | 2 +- js/tiletypes.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/game.js b/js/game.js index bd29d9e..10b2307 100644 --- a/js/game.js +++ b/js/game.js @@ -1618,7 +1618,7 @@ export class Level extends LevelInterface { let original_name = tile.type.name; // TODO check ignores here? if (tile.type.on_bumped) { - tile.type.on_bumped(tile, this, actor); + tile.type.on_bumped(tile, this, actor, direction); } // Death happens here: if a monster or block even thinks about moving into a player, or diff --git a/js/tiletypes.js b/js/tiletypes.js index d38ab81..96698e0 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -1226,10 +1226,10 @@ const TILE_TYPES = { return null; } }, - on_bumped(me, level, other) { + on_bumped(me, level, other, direction) { if (other.type.name === 'boulder') { level._set_tile_prop(me, 'rolling', true); - level._set_tile_prop(me, 'direction', other.direction); + level._set_tile_prop(me, 'direction', direction); level._set_tile_prop(other, 'rolling', false); } }, From 71abc13330d2cf06320c8f4644f2db270575d85f Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Sat, 20 Nov 2021 12:57:58 +1100 Subject: [PATCH 08/10] let any actor with a key unlock gates (unlike doors) --- js/editor/editordefs.js | 2 +- js/tiletypes.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/js/editor/editordefs.js b/js/editor/editordefs.js index 4be0ffe..9ab37c8 100644 --- a/js/editor/editordefs.js +++ b/js/editor/editordefs.js @@ -894,7 +894,7 @@ export const TILE_DESCRIPTIONS = { }, gate_red: { name: "Red gate", - desc: "Requires a red key. Unlike doors, may be placed on top of other terrain.", + desc: "Requires a red key. Unlike doors, may be placed on top of other terrain, and any actor with the key may unlock it.", }, sand: { name: "Sand", diff --git a/js/tiletypes.js b/js/tiletypes.js index 96698e0..2697a9a 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -34,8 +34,7 @@ function _define_door(key) { function _define_gate(key) { return { layer: LAYERS.canopy, - // Doors can be opened by ice blocks, but not dirt blocks or monsters - blocks_collision: COLLISION.block_cc1 | COLLISION.monster_typical, + // Unlike doors, anything with the key (or a ghost) can step on them blocks(me, level, other) { if (other.type.name === 'ghost') return false; From 073aba65ab83915b00a54dcc4e23ebe2c287361d Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Sun, 21 Nov 2021 14:47:40 +1100 Subject: [PATCH 09/10] glass block with a heart shouldn't crash (fixes #84) --- js/tileset.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/tileset.js b/js/tileset.js index 9c7bc89..6743c0b 100644 --- a/js/tileset.js +++ b/js/tileset.js @@ -2634,7 +2634,7 @@ export class Tileset { _draw_encased_item(drawspec, name, tile, packet) { //draw the encased item if (tile !== null && tile.encased_item !== undefined && tile.encased_item !== null) { - this._draw_standard(this.layout[tile.encased_item], tile.encased_item, null, packet); + this.draw_drawspec(this.layout[tile.encased_item], tile.encased_item, null, packet); } //then draw the glass block this._draw_standard(drawspec.base, name, tile, packet); From 6f27332cceb3dd3161fdbb515e676be5397b0a4e Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Sun, 28 Nov 2021 18:26:18 +1100 Subject: [PATCH 10/10] Cerise doesn't break cracked tiles (because she's dainty) Teal Knight suggestion. It's a purely backwards compatible way to distinguish the two characters a little more, and fits her theme, but it's up to you. --- js/editor/editordefs.js | 4 ++-- js/tiletypes.js | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/js/editor/editordefs.js b/js/editor/editordefs.js index 9ab37c8..0f3f04b 100644 --- a/js/editor/editordefs.js +++ b/js/editor/editordefs.js @@ -922,11 +922,11 @@ export const TILE_DESCRIPTIONS = { }, cracked_floor: { name: "Cracked floor", - desc: "Turns into a hole when something steps off of it (except ghosts).", + desc: "Turns into a hole when something steps off of it (except ghosts and Cerise).", }, cracked_ice: { name: "Cracked ice", - desc: "Turns into water when something steps off of it (except ghosts).", + desc: "Turns into water when something steps off of it (except ghosts and Cerise).", }, score_5x: { name: "×5 bonus", diff --git a/js/tiletypes.js b/js/tiletypes.js index 2697a9a..17d3004 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -3005,8 +3005,7 @@ const TILE_TYPES = { item_pickup_priority: PICKUP_PRIORITIES.real_player, can_reveal_walls: true, movement_speed: 4, - ignores: new Set(['ice', 'ice_nw', 'ice_ne', 'ice_sw', 'ice_se']), - slide_ignores: new Set(['cracked_ice']), + ignores: new Set(['ice', 'ice_nw', 'ice_ne', 'ice_sw', 'ice_se', 'cracked_ice', 'cracked_floor']), pushes: { dirt_block: true, ice_block: true, @@ -3060,8 +3059,7 @@ const TILE_TYPES = { item_pickup_priority: PICKUP_PRIORITIES.player, can_reveal_walls: true, // XXX i think? movement_speed: 4, - ignores: new Set(['ice', 'ice_nw', 'ice_ne', 'ice_sw', 'ice_se']), - slide_ignores: new Set(['cracked_ice']), + ignores: new Set(['ice', 'ice_nw', 'ice_ne', 'ice_sw', 'ice_se', 'cracked_ice', 'cracked_floor']), pushes: { dirt_block: true, ice_block: true,