Make (most) actors pick up blue keys
This commit is contained in:
parent
197113c842
commit
36b9f2efd7
@ -1253,6 +1253,7 @@ export class Level {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Give an item to an actor, even if it's not supposed to have an inventory
|
||||||
give_actor(actor, name) {
|
give_actor(actor, name) {
|
||||||
if (! actor.type.is_actor)
|
if (! actor.type.is_actor)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -1185,17 +1185,32 @@ const TILE_TYPES = {
|
|||||||
movement_speed: 4,
|
movement_speed: 4,
|
||||||
},
|
},
|
||||||
|
|
||||||
// Keys
|
// Keys, whose behavior varies
|
||||||
// Note that red and blue keys do NOT block monsters, but yellow and green DO
|
|
||||||
key_red: {
|
key_red: {
|
||||||
|
// TODO Red key can ONLY be picked up by players (and doppelgangers), no other actor that
|
||||||
|
// has an inventory
|
||||||
draw_layer: LAYER_ITEM,
|
draw_layer: LAYER_ITEM,
|
||||||
is_item: true,
|
is_item: true,
|
||||||
is_key: true,
|
is_key: true,
|
||||||
},
|
},
|
||||||
key_blue: {
|
key_blue: {
|
||||||
|
// Blue key is picked up by dirt blocks and all monsters, including those that don't have an
|
||||||
|
// inventory normally
|
||||||
draw_layer: LAYER_ITEM,
|
draw_layer: LAYER_ITEM,
|
||||||
is_item: true,
|
is_item: true,
|
||||||
is_key: true,
|
is_key: true,
|
||||||
|
on_arrive(me, level, other) {
|
||||||
|
// Call it... everything except ice and directional blocks? These rules are weird.
|
||||||
|
// Note that the game itself normally handles picking items up, so we only get here for
|
||||||
|
// actors who aren't supposed to have an inventory
|
||||||
|
// TODO make this a... flag? i don't know?
|
||||||
|
// TODO major difference from lynx...
|
||||||
|
if (other.type.name !== 'ice_block' && other.type.name !== 'directional_block') {
|
||||||
|
if (level.give_actor(other, me.type.name)) {
|
||||||
|
level.remove_tile(me);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
key_yellow: {
|
key_yellow: {
|
||||||
draw_layer: LAYER_ITEM,
|
draw_layer: LAYER_ITEM,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user