Fix door collision to act like dirt and not check has_inventory (fixes #29)
This commit is contained in:
parent
32a5bc31bb
commit
1e38ccdc30
@ -49,13 +49,12 @@ function blocks_leaving_thin_walls(me, actor, direction) {
|
|||||||
function _define_door(key) {
|
function _define_door(key) {
|
||||||
return {
|
return {
|
||||||
layer: LAYERS.terrain,
|
layer: LAYERS.terrain,
|
||||||
// Doors can be opened by ice blocks, but not dirt blocks
|
// Doors can be opened by ice blocks, but not dirt blocks or monsters
|
||||||
blocks_collision: COLLISION.block_cc1,
|
blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover),
|
||||||
blocks(me, level, other) {
|
blocks(me, level, other) {
|
||||||
if (other.type.name === 'ghost')
|
if (other.type.name === 'ghost')
|
||||||
return false;
|
return false;
|
||||||
return ! (other.type.has_inventory &&
|
return ! ((other.has_item(key) || other.has_item('skeleton_key')));
|
||||||
(other.has_item(key) || other.has_item('skeleton_key')));
|
|
||||||
},
|
},
|
||||||
on_arrive(me, level, other) {
|
on_arrive(me, level, other) {
|
||||||
if (level.take_key_from_actor(other, key) ||
|
if (level.take_key_from_actor(other, key) ||
|
||||||
@ -71,13 +70,12 @@ function _define_door(key) {
|
|||||||
function _define_gate(key) {
|
function _define_gate(key) {
|
||||||
return {
|
return {
|
||||||
layer: LAYERS.item,
|
layer: LAYERS.item,
|
||||||
// Doors can be opened by ice blocks, but not dirt blocks
|
// Doors can be opened by ice blocks, but not dirt blocks or monsters
|
||||||
blocks_collision: COLLISION.block_cc1,
|
blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover),
|
||||||
blocks(me, level, other) {
|
blocks(me, level, other) {
|
||||||
if (other.type.name === 'ghost')
|
if (other.type.name === 'ghost')
|
||||||
return false;
|
return false;
|
||||||
return ! (other.type.has_inventory &&
|
return ! ((other.has_item(key) || other.has_item('skeleton_key')));
|
||||||
(other.has_item(key) || other.has_item('skeleton_key')));
|
|
||||||
},
|
},
|
||||||
on_arrive(me, level, other) {
|
on_arrive(me, level, other) {
|
||||||
if (level.take_key_from_actor(other, key) ||
|
if (level.take_key_from_actor(other, key) ||
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user