Merge pull request #83 from Patashu/bug-fixes
Experimental tile bug fixes
This commit is contained in:
commit
47313521ed
@ -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",
|
||||
@ -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",
|
||||
|
||||
@ -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;
|
||||
|
||||
17
js/game.js
17
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
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -2637,6 +2636,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 +2804,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];
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
@ -1226,10 +1225,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);
|
||||
}
|
||||
},
|
||||
@ -1278,7 +1277,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);
|
||||
@ -1978,6 +1977,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;
|
||||
},
|
||||
@ -1994,7 +1994,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;
|
||||
@ -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;
|
||||
@ -3005,7 +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', '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,
|
||||
@ -3059,7 +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', '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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user