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: {
|
gate_red: {
|
||||||
name: "Red gate",
|
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: {
|
sand: {
|
||||||
name: "Sand",
|
name: "Sand",
|
||||||
@ -922,11 +922,11 @@ export const TILE_DESCRIPTIONS = {
|
|||||||
},
|
},
|
||||||
cracked_floor: {
|
cracked_floor: {
|
||||||
name: "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: {
|
cracked_ice: {
|
||||||
name: "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: {
|
score_5x: {
|
||||||
name: "×5 bonus",
|
name: "×5 bonus",
|
||||||
|
|||||||
@ -1438,7 +1438,7 @@ export class Editor extends PrimaryView {
|
|||||||
// Special case: preserve wires when replacing one wired tile with another
|
// Special case: preserve wires when replacing one wired tile with another
|
||||||
if (new_tile.type.contains_wire &&
|
if (new_tile.type.contains_wire &&
|
||||||
// FIXME this is hacky garbage
|
// 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) {
|
if (existing_tile.type.contains_wire) {
|
||||||
new_tile.wire_directions = existing_tile.wire_directions;
|
new_tile.wire_directions = existing_tile.wire_directions;
|
||||||
|
|||||||
15
js/game.js
15
js/game.js
@ -1618,7 +1618,7 @@ export class Level extends LevelInterface {
|
|||||||
let original_name = tile.type.name;
|
let original_name = tile.type.name;
|
||||||
// TODO check ignores here?
|
// TODO check ignores here?
|
||||||
if (tile.type.on_bumped) {
|
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
|
// 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
|
// 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
|
// 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.
|
// 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
|
// 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
|
// successfully, which means the hook can never stop us from moving and hook slapping is not
|
||||||
@ -1969,8 +1969,6 @@ export class Level extends LevelInterface {
|
|||||||
continue;
|
continue;
|
||||||
if (actor.ignores(tile.type.name))
|
if (actor.ignores(tile.type.name))
|
||||||
continue;
|
continue;
|
||||||
if (actor.slide_ignores(tile.type.name))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (tile.type.on_approach) {
|
if (tile.type.on_approach) {
|
||||||
tile.type.on_approach(tile, this, actor);
|
tile.type.on_approach(tile, this, actor);
|
||||||
@ -2036,7 +2034,8 @@ export class Level extends LevelInterface {
|
|||||||
continue;
|
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);
|
tile.type.on_arrive(tile, this, actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2637,6 +2636,7 @@ export class Level extends LevelInterface {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//only used for glass block atm
|
||||||
if (actor.type.on_death) {
|
if (actor.type.on_death) {
|
||||||
actor.type.on_death(actor, this);
|
actor.type.on_death(actor, this);
|
||||||
}
|
}
|
||||||
@ -2805,6 +2805,11 @@ export class Level extends LevelInterface {
|
|||||||
return;
|
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 old_type = tile.type;
|
||||||
let new_type = TILE_TYPES[name];
|
let new_type = TILE_TYPES[name];
|
||||||
if (old_type.layer !== new_type.layer) {
|
if (old_type.layer !== new_type.layer) {
|
||||||
|
|||||||
@ -2634,7 +2634,7 @@ export class Tileset {
|
|||||||
_draw_encased_item(drawspec, name, tile, packet) {
|
_draw_encased_item(drawspec, name, tile, packet) {
|
||||||
//draw the encased item
|
//draw the encased item
|
||||||
if (tile !== null && tile.encased_item !== undefined && tile.encased_item !== null) {
|
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
|
//then draw the glass block
|
||||||
this._draw_standard(drawspec.base, name, tile, packet);
|
this._draw_standard(drawspec.base, name, tile, packet);
|
||||||
|
|||||||
@ -34,8 +34,7 @@ function _define_door(key) {
|
|||||||
function _define_gate(key) {
|
function _define_gate(key) {
|
||||||
return {
|
return {
|
||||||
layer: LAYERS.canopy,
|
layer: LAYERS.canopy,
|
||||||
// Doors can be opened by ice blocks, but not dirt blocks or monsters
|
// Unlike doors, anything with the key (or a ghost) can step on them
|
||||||
blocks_collision: COLLISION.block_cc1 | COLLISION.monster_typical,
|
|
||||||
blocks(me, level, other) {
|
blocks(me, level, other) {
|
||||||
if (other.type.name === 'ghost')
|
if (other.type.name === 'ghost')
|
||||||
return false;
|
return false;
|
||||||
@ -1226,10 +1225,10 @@ const TILE_TYPES = {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_bumped(me, level, other) {
|
on_bumped(me, level, other, direction) {
|
||||||
if (other.type.name === 'boulder') {
|
if (other.type.name === 'boulder') {
|
||||||
level._set_tile_prop(me, 'rolling', true);
|
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);
|
level._set_tile_prop(other, 'rolling', false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1278,7 +1277,7 @@ const TILE_TYPES = {
|
|||||||
return other.cell.get_item() !== null && me.encased_item !== null;
|
return other.cell.get_item() !== null && me.encased_item !== null;
|
||||||
},
|
},
|
||||||
on_death(me, level) {
|
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) {
|
if (me.encased_item !== null) {
|
||||||
level._place_dropped_item(me.encased_item, me.cell ?? me.previous_cell, me);
|
level._place_dropped_item(me.encased_item, me.cell ?? me.previous_cell, me);
|
||||||
level._set_tile_prop(me, 'encased_item', null);
|
level._set_tile_prop(me, 'encased_item', null);
|
||||||
@ -1978,6 +1977,7 @@ const TILE_TYPES = {
|
|||||||
layer: LAYERS.terrain,
|
layer: LAYERS.terrain,
|
||||||
wire_propagation_mode: 'all',
|
wire_propagation_mode: 'all',
|
||||||
on_begin(me, level) {
|
on_begin(me, level) {
|
||||||
|
level._set_tile_prop(me, 'is_active', false);
|
||||||
level._set_tile_prop(me, 'wire_directions', 15);
|
level._set_tile_prop(me, 'wire_directions', 15);
|
||||||
level.recalculate_circuitry_next_wire_phase = true;
|
level.recalculate_circuitry_next_wire_phase = true;
|
||||||
},
|
},
|
||||||
@ -1994,7 +1994,7 @@ const TILE_TYPES = {
|
|||||||
level._set_tile_prop(me, 'is_active', false);
|
level._set_tile_prop(me, 'is_active', false);
|
||||||
},
|
},
|
||||||
on_death(me, level) {
|
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
|
//need to remove our wires since they're an implementation detail
|
||||||
level._set_tile_prop(me, 'wire_directions', 0);
|
level._set_tile_prop(me, 'wire_directions', 0);
|
||||||
level.recalculate_circuitry_next_wire_phase = true;
|
level.recalculate_circuitry_next_wire_phase = true;
|
||||||
@ -2952,7 +2952,7 @@ const TILE_TYPES = {
|
|||||||
{
|
{
|
||||||
if (level.ankh_tile) {
|
if (level.ankh_tile) {
|
||||||
level.transmute_tile(level.ankh_tile, 'floor');
|
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;
|
let old_tile = level.ankh_tile;
|
||||||
level.ankh_tile = terrain;
|
level.ankh_tile = terrain;
|
||||||
@ -3005,7 +3005,7 @@ const TILE_TYPES = {
|
|||||||
item_pickup_priority: PICKUP_PRIORITIES.real_player,
|
item_pickup_priority: PICKUP_PRIORITIES.real_player,
|
||||||
can_reveal_walls: true,
|
can_reveal_walls: true,
|
||||||
movement_speed: 4,
|
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: {
|
pushes: {
|
||||||
dirt_block: true,
|
dirt_block: true,
|
||||||
ice_block: true,
|
ice_block: true,
|
||||||
@ -3059,7 +3059,7 @@ const TILE_TYPES = {
|
|||||||
item_pickup_priority: PICKUP_PRIORITIES.player,
|
item_pickup_priority: PICKUP_PRIORITIES.player,
|
||||||
can_reveal_walls: true, // XXX i think?
|
can_reveal_walls: true, // XXX i think?
|
||||||
movement_speed: 4,
|
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: {
|
pushes: {
|
||||||
dirt_block: true,
|
dirt_block: true,
|
||||||
ice_block: true,
|
ice_block: true,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user