Implement Electrified Floor
Conducts power (like a blue teleporter). While powered, destroys anything not wearing lightning boots (except dirt blocks).
This commit is contained in:
parent
d874e4d956
commit
1f6c86c146
@ -787,6 +787,10 @@ const TILE_ENCODING = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// LL-specific tiles
|
// LL-specific tiles
|
||||||
|
0xd0: {
|
||||||
|
name: 'electrified_floor',
|
||||||
|
is_extension: true,
|
||||||
|
},
|
||||||
0xe0: {
|
0xe0: {
|
||||||
name: 'gift_bow',
|
name: 'gift_bow',
|
||||||
has_next: true,
|
has_next: true,
|
||||||
|
|||||||
@ -1604,6 +1604,7 @@ const EDITOR_PALETTE = [{
|
|||||||
'fire_sticks',
|
'fire_sticks',
|
||||||
'turntable_cw',
|
'turntable_cw',
|
||||||
'turntable_ccw',
|
'turntable_ccw',
|
||||||
|
'electrified_floor',
|
||||||
],
|
],
|
||||||
}];
|
}];
|
||||||
|
|
||||||
@ -2202,6 +2203,10 @@ const EDITOR_TILE_DESCRIPTIONS = {
|
|||||||
name: "Turntable (Counterclockwise)",
|
name: "Turntable (Counterclockwise)",
|
||||||
desc: "Rotates anything entering this tile counterclockwise. Frame blocks are rotated too. If connected to wire, only functions while receiving power.",
|
desc: "Rotates anything entering this tile counterclockwise. Frame blocks are rotated too. If connected to wire, only functions while receiving power.",
|
||||||
},
|
},
|
||||||
|
electrified_floor: {
|
||||||
|
name: "Electrified Floor",
|
||||||
|
desc: "Conducts power (like a blue teleporter). While powered, destroys anything not wearing lightning boots (except dirt blocks).",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const SPECIAL_PALETTE_ENTRIES = {
|
const SPECIAL_PALETTE_ENTRIES = {
|
||||||
|
|||||||
@ -91,6 +91,12 @@ const OBITUARIES = {
|
|||||||
"no place to be",
|
"no place to be",
|
||||||
"on a trip to nowhere",
|
"on a trip to nowhere",
|
||||||
],
|
],
|
||||||
|
electrocuted: [
|
||||||
|
"a shocking revelation",
|
||||||
|
"danger: high voltage",
|
||||||
|
"inadequate insulation",
|
||||||
|
"rode the lightning",
|
||||||
|
],
|
||||||
generic: [
|
generic: [
|
||||||
"you had a bad time",
|
"you had a bad time",
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1048,6 +1048,11 @@ export const LL_TILESET_LAYOUT = Object.assign({}, CC2_TILESET_LAYOUT, {
|
|||||||
active: [8, 43],
|
active: [8, 43],
|
||||||
inactive: [10, 43],
|
inactive: [10, 43],
|
||||||
},
|
},
|
||||||
|
electrified_floor: {
|
||||||
|
__special__: 'visual-state',
|
||||||
|
active: [[5, 41], [6, 41], [7, 41]],
|
||||||
|
inactive: [4, 41],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const TILESET_LAYOUTS = {
|
export const TILESET_LAYOUTS = {
|
||||||
|
|||||||
@ -169,6 +169,9 @@ function player_visual_state(me) {
|
|||||||
else if (me.fail_reason === 'slimed') {
|
else if (me.fail_reason === 'slimed') {
|
||||||
return 'slimed';
|
return 'slimed';
|
||||||
}
|
}
|
||||||
|
else if (me.fail_reason === 'electrocuted') {
|
||||||
|
return 'burned'; //same gfx for now
|
||||||
|
}
|
||||||
else if (me.fail_reason) {
|
else if (me.fail_reason) {
|
||||||
return 'failed';
|
return 'failed';
|
||||||
}
|
}
|
||||||
@ -1108,7 +1111,7 @@ const TILE_TYPES = {
|
|||||||
blocks_collision: COLLISION.all,
|
blocks_collision: COLLISION.all,
|
||||||
is_actor: true,
|
is_actor: true,
|
||||||
is_block: true,
|
is_block: true,
|
||||||
ignores: new Set(['fire', 'flame_jet_on']),
|
ignores: new Set(['fire', 'flame_jet_on', 'electrified_floor']),
|
||||||
can_reverse_on_railroad: true,
|
can_reverse_on_railroad: true,
|
||||||
movement_speed: 4,
|
movement_speed: 4,
|
||||||
},
|
},
|
||||||
@ -1885,6 +1888,44 @@ const TILE_TYPES = {
|
|||||||
me.type.activate(me, level);
|
me.type.activate(me, level);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
electrified_floor: {
|
||||||
|
layer: LAYERS.terrain,
|
||||||
|
wire_propagation_mode: 'all',
|
||||||
|
on_begin(me, level) {
|
||||||
|
// TODO if wire destruction is ever allowed, this will need to update somehow
|
||||||
|
me.is_wired = level.is_tile_wired(me, false);
|
||||||
|
me.is_active = ! me.is_wired;
|
||||||
|
},
|
||||||
|
on_tic(me, level) {
|
||||||
|
if (me.is_active)
|
||||||
|
{
|
||||||
|
let actor = me.cell.get_actor();
|
||||||
|
if (actor && actor.movement_cooldown <= 0 && ! actor.ignores(me.type.name)) {
|
||||||
|
if (actor.type.is_real_player) {
|
||||||
|
level.fail('electrocuted', me, actor);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
level.sfx.play_once('bomb', me.cell);
|
||||||
|
level.transmute_tile(actor, 'explosion');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
on_power(me, level) {
|
||||||
|
if (me.is_wired) {
|
||||||
|
level._set_tile_prop(me, 'is_active', true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
on_depower(me, level) {
|
||||||
|
if (me.is_wired) {
|
||||||
|
level._set_tile_prop(me, 'is_active', false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
visual_state(me) {
|
||||||
|
return ! me || me.is_active ? 'active' : 'inactive';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
// Buttons
|
// Buttons
|
||||||
button_blue: {
|
button_blue: {
|
||||||
layer: LAYERS.terrain,
|
layer: LAYERS.terrain,
|
||||||
@ -2855,6 +2896,7 @@ const TILE_TYPES = {
|
|||||||
is_item: true,
|
is_item: true,
|
||||||
is_tool: true,
|
is_tool: true,
|
||||||
blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover),
|
blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover),
|
||||||
|
item_ignores: new Set(['electrified_floor']),
|
||||||
},
|
},
|
||||||
speed_boots: {
|
speed_boots: {
|
||||||
layer: LAYERS.item,
|
layer: LAYERS.item,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user