Factor out the list of pushable tiles
This commit is contained in:
parent
cddc274701
commit
933d20d559
@ -236,6 +236,15 @@ const COMMON_TOOL = {
|
|||||||
blocks_collision: COLLISION.block_cc1 | COLLISION.monster_typical,
|
blocks_collision: COLLISION.block_cc1 | COLLISION.monster_typical,
|
||||||
item_priority: PICKUP_PRIORITIES.normal,
|
item_priority: PICKUP_PRIORITIES.normal,
|
||||||
};
|
};
|
||||||
|
const COMMON_PUSHES = {
|
||||||
|
dirt_block: true,
|
||||||
|
ice_block: true,
|
||||||
|
frame_block: true,
|
||||||
|
circuit_block: true,
|
||||||
|
boulder: true,
|
||||||
|
glass_block: true,
|
||||||
|
sokoban_block: true,
|
||||||
|
};
|
||||||
|
|
||||||
const TILE_TYPES = {
|
const TILE_TYPES = {
|
||||||
// Floors and walls
|
// Floors and walls
|
||||||
@ -1147,11 +1156,9 @@ const TILE_TYPES = {
|
|||||||
can_reverse_on_railroad: true,
|
can_reverse_on_railroad: true,
|
||||||
movement_speed: 4,
|
movement_speed: 4,
|
||||||
pushes: {
|
pushes: {
|
||||||
ice_block: true,
|
// Ice blocks specifically cannot push dirt blocks
|
||||||
frame_block: true,
|
...COMMON_PUSHES,
|
||||||
boulder: true,
|
dirt_block: false,
|
||||||
glass_block: true,
|
|
||||||
sokoban_block: true,
|
|
||||||
},
|
},
|
||||||
on_after_bumped(me, level, other) {
|
on_after_bumped(me, level, other) {
|
||||||
// Fireballs melt ice blocks on regular floor FIXME and water!
|
// Fireballs melt ice blocks on regular floor FIXME and water!
|
||||||
@ -1179,14 +1186,7 @@ const TILE_TYPES = {
|
|||||||
allows_push(me, direction) {
|
allows_push(me, direction) {
|
||||||
return me.arrows && me.arrows.has(direction);
|
return me.arrows && me.arrows.has(direction);
|
||||||
},
|
},
|
||||||
pushes: {
|
pushes: COMMON_PUSHES,
|
||||||
dirt_block: true,
|
|
||||||
ice_block: true,
|
|
||||||
frame_block: true,
|
|
||||||
boulder: true,
|
|
||||||
glass_block: true,
|
|
||||||
sokoban_block: true,
|
|
||||||
},
|
|
||||||
on_clone(me, original) {
|
on_clone(me, original) {
|
||||||
me.arrows = new Set(original.arrows);
|
me.arrows = new Set(original.arrows);
|
||||||
},
|
},
|
||||||
@ -1208,10 +1208,11 @@ const TILE_TYPES = {
|
|||||||
is_actor: true,
|
is_actor: true,
|
||||||
is_block: true,
|
is_block: true,
|
||||||
can_reveal_walls: true,
|
can_reveal_walls: true,
|
||||||
|
// Boulders don't directly push each other; instead on_bumped will propagate the momentum
|
||||||
|
// XXX can they not push other kinds of blocks?
|
||||||
pushes: {
|
pushes: {
|
||||||
ice_block: true,
|
ice_block: true,
|
||||||
frame_block: true,
|
frame_block: true,
|
||||||
//boulders don't push each other; instead on_bumped will chain through them
|
|
||||||
},
|
},
|
||||||
ignores: new Set(['fire', 'flame_jet_on', 'electrified_floor']),
|
ignores: new Set(['fire', 'flame_jet_on', 'electrified_floor']),
|
||||||
can_reverse_on_railroad: true,
|
can_reverse_on_railroad: true,
|
||||||
@ -1249,7 +1250,9 @@ const TILE_TYPES = {
|
|||||||
can_reverse_on_railroad: true,
|
can_reverse_on_railroad: true,
|
||||||
movement_speed: 4,
|
movement_speed: 4,
|
||||||
try_pickup_item(me, level) {
|
try_pickup_item(me, level) {
|
||||||
//suck up any item that ever CAN be picked up off of the floor and put it in our encased_item slot (not an inventory since e.g. a glass block with red key can't unlock red doors)
|
// Suck up any item that could be picked up off of the floor, and put it in our
|
||||||
|
// encased_item slot (which is, somewhat confusingly, distinct from our inventory -- we
|
||||||
|
// cannot actually make use of our encased item)
|
||||||
if (me.encased_item === null) {
|
if (me.encased_item === null) {
|
||||||
let item = me.cell.get_item();
|
let item = me.cell.get_item();
|
||||||
let mod = me.cell.get_item_mod();
|
let mod = me.cell.get_item_mod();
|
||||||
@ -2513,15 +2516,7 @@ const TILE_TYPES = {
|
|||||||
tank_yellow: {
|
tank_yellow: {
|
||||||
...COMMON_MONSTER,
|
...COMMON_MONSTER,
|
||||||
collision_mask: COLLISION.yellow_tank,
|
collision_mask: COLLISION.yellow_tank,
|
||||||
pushes: {
|
pushes: COMMON_PUSHES,
|
||||||
dirt_block: true,
|
|
||||||
ice_block: true,
|
|
||||||
frame_block: true,
|
|
||||||
circuit_block: true,
|
|
||||||
boulder: true,
|
|
||||||
glass_block: true,
|
|
||||||
sokoban_block: true,
|
|
||||||
},
|
|
||||||
decide_movement(me, level) {
|
decide_movement(me, level) {
|
||||||
if (me.pending_decision) {
|
if (me.pending_decision) {
|
||||||
let decision = me.pending_decision;
|
let decision = me.pending_decision;
|
||||||
@ -2639,16 +2634,7 @@ const TILE_TYPES = {
|
|||||||
can_reveal_walls: true,
|
can_reveal_walls: true,
|
||||||
movement_speed: 8,
|
movement_speed: 8,
|
||||||
movement_parity: 2,
|
movement_parity: 2,
|
||||||
// FIXME basically everyone has this same set of objects listed?
|
pushes: COMMON_PUSHES,
|
||||||
pushes: {
|
|
||||||
dirt_block: true,
|
|
||||||
ice_block: true,
|
|
||||||
frame_block: true,
|
|
||||||
circuit_block: true,
|
|
||||||
boulder: true,
|
|
||||||
glass_block: true,
|
|
||||||
sokoban_block: true,
|
|
||||||
},
|
|
||||||
on_ready(me, level) {
|
on_ready(me, level) {
|
||||||
me.current_emulatee = 0;
|
me.current_emulatee = 0;
|
||||||
me.attempted_moves = 0;
|
me.attempted_moves = 0;
|
||||||
@ -2974,15 +2960,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,
|
||||||
pushes: {
|
pushes: COMMON_PUSHES,
|
||||||
dirt_block: true,
|
|
||||||
ice_block: true,
|
|
||||||
frame_block: true,
|
|
||||||
circuit_block: true,
|
|
||||||
boulder: true,
|
|
||||||
glass_block: true,
|
|
||||||
sokoban_block: true,
|
|
||||||
},
|
|
||||||
infinite_items: {
|
infinite_items: {
|
||||||
key_green: true,
|
key_green: true,
|
||||||
},
|
},
|
||||||
@ -2999,15 +2977,7 @@ const TILE_TYPES = {
|
|||||||
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', 'cracked_floor']),
|
ignores: new Set(['ice', 'ice_nw', 'ice_ne', 'ice_sw', 'ice_se', 'cracked_ice', 'cracked_floor']),
|
||||||
pushes: {
|
pushes: COMMON_PUSHES,
|
||||||
dirt_block: true,
|
|
||||||
ice_block: true,
|
|
||||||
frame_block: true,
|
|
||||||
circuit_block: true,
|
|
||||||
boulder: true,
|
|
||||||
glass_block: true,
|
|
||||||
sokoban_block: true,
|
|
||||||
},
|
|
||||||
infinite_items: {
|
infinite_items: {
|
||||||
key_yellow: true,
|
key_yellow: true,
|
||||||
},
|
},
|
||||||
@ -3024,15 +2994,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,
|
||||||
pushes: {
|
pushes: COMMON_PUSHES,
|
||||||
dirt_block: true,
|
|
||||||
ice_block: true,
|
|
||||||
frame_block: true,
|
|
||||||
circuit_block: true,
|
|
||||||
boulder: true,
|
|
||||||
glass_block: true,
|
|
||||||
sokoban_block: true,
|
|
||||||
},
|
|
||||||
infinite_items: {
|
infinite_items: {
|
||||||
key_green: true,
|
key_green: true,
|
||||||
},
|
},
|
||||||
@ -3053,15 +3015,7 @@ const TILE_TYPES = {
|
|||||||
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', 'cracked_floor']),
|
ignores: new Set(['ice', 'ice_nw', 'ice_ne', 'ice_sw', 'ice_se', 'cracked_ice', 'cracked_floor']),
|
||||||
pushes: {
|
pushes: COMMON_PUSHES,
|
||||||
dirt_block: true,
|
|
||||||
ice_block: true,
|
|
||||||
frame_block: true,
|
|
||||||
circuit_block: true,
|
|
||||||
boulder: true,
|
|
||||||
glass_block: true,
|
|
||||||
sokoban_block: true,
|
|
||||||
},
|
|
||||||
infinite_items: {
|
infinite_items: {
|
||||||
key_yellow: true,
|
key_yellow: true,
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user