This commit is contained in:
Timothy Stiles 2021-02-06 16:07:40 +11:00
parent e134b4cbd9
commit 0100f1e12c
6 changed files with 157 additions and 157 deletions

View File

@ -799,67 +799,67 @@ const TILE_ENCODING = {
extra_args: [arg_direction], extra_args: [arg_direction],
is_extension: true, is_extension: true,
}, },
0xe2: { 0xe2: {
name: 'skeleton_key', name: 'skeleton_key',
has_next: true, has_next: true,
is_extension: true, is_extension: true,
}, },
0xe2: { 0xe2: {
name: 'gate_red', name: 'gate_red',
has_next: true, has_next: true,
is_extension: true, is_extension: true,
}, },
0xe3: { 0xe3: {
name: 'gate_blue', name: 'gate_blue',
has_next: true, has_next: true,
is_extension: true, is_extension: true,
}, },
0xe4: { 0xe4: {
name: 'gate_yellow', name: 'gate_yellow',
has_next: true, has_next: true,
is_extension: true, is_extension: true,
}, },
0xe5: { 0xe5: {
name: 'gate_green', name: 'gate_green',
has_next: true, has_next: true,
is_extension: true, is_extension: true,
}, },
0xe6: { 0xe6: {
name: 'sand', name: 'sand',
has_next: true, has_next: true,
is_extension: true, is_extension: true,
}, },
0xe7: { 0xe7: {
name: 'terraformer_n', name: 'terraformer_n',
has_next: true, has_next: true,
is_extension: true, is_extension: true,
}, },
0xe8: { 0xe8: {
name: 'terraformer_e', name: 'terraformer_e',
has_next: true, has_next: true,
is_extension: true, is_extension: true,
}, },
0xe9: { 0xe9: {
name: 'terraformer_s', name: 'terraformer_s',
has_next: true, has_next: true,
is_extension: true, is_extension: true,
}, },
0xea: { 0xea: {
name: 'terraformer_w', name: 'terraformer_w',
has_next: true, has_next: true,
is_extension: true, is_extension: true,
}, },
0xeb: { 0xeb: {
name: 'global_cycler', name: 'global_cycler',
has_next: true, has_next: true,
is_extension: true, is_extension: true,
}, },
0xec: { 0xec: {
name: 'halo', name: 'halo',
has_next: true, has_next: true,
is_extension: true, is_extension: true,
}, },
0xed: { 0xed: {
name: 'fire_sticks', name: 'fire_sticks',
has_next: true, has_next: true,
is_extension: true, is_extension: true,

View File

@ -2279,25 +2279,25 @@ export class Level extends LevelInterface {
player = this.player; player = this.player;
} }
if (this.take_tool_from_actor(player, 'halo')) { if (this.take_tool_from_actor(player, 'halo')) {
this.sfx.play_once('revive'); this.sfx.play_once('revive');
if (reason === 'time') if (reason === 'time')
{ {
this.pause_timer(); this.pause_timer();
} }
else if (killer !== null) else if (killer !== null)
{ {
if (killer.type.is_actor || killer.type.is_item) if (killer.type.is_actor || killer.type.is_item)
{ {
this.remove_tile(killer); this.remove_tile(killer);
} }
else //presumably terrain else //presumably terrain
{ {
this.transmute_tile(killer, 'floor'); this.transmute_tile(killer, 'floor');
} }
} }
return; return;
} }
this._push_pending_undo(() => { this._push_pending_undo(() => {
this.fail_reason = null; this.fail_reason = null;

View File

@ -1600,8 +1600,8 @@ const EDITOR_PALETTE = [{
'sand', 'sand',
'terraformer_n', 'terraformer_n',
'global_cycler', 'global_cycler',
'halo', 'halo',
'fire_sticks', 'fire_sticks',
], ],
}]; }];
@ -2184,14 +2184,14 @@ const EDITOR_TILE_DESCRIPTIONS = {
name: "Global Cycler", name: "Global Cycler",
desc: "When activated, every terrain/item on the surrounding four tiles in the entire level becomes the terrain/item one clockwise. Adjacent tiles with a 'no sign' on them are ignored. Two of the same tile in a row mean that tile will not be transformed and will stay as-is. Tiles next to Global Cyclers are not transformed.", desc: "When activated, every terrain/item on the surrounding four tiles in the entire level becomes the terrain/item one clockwise. Adjacent tiles with a 'no sign' on them are ignored. Two of the same tile in a row mean that tile will not be transformed and will stay as-is. Tiles next to Global Cyclers are not transformed.",
}, },
halo: { halo: {
name: "Halo", name: "Halo",
desc: "Protects the player from death once, destroying the would-be killer in the process.", desc: "Protects the player from death once, destroying the would-be killer in the process.",
}, },
fire_sticks: { fire_sticks: {
name: "Dormant Lava", name: "Dormant Lava",
desc: "Acts like dirt. However, fireballs will enter it and turn it into Fire in the process.", desc: "Acts like dirt. However, fireballs will enter it and turn it into Fire in the process.",
}, },
}; };
const SPECIAL_PALETTE_ENTRIES = { const SPECIAL_PALETTE_ENTRIES = {

View File

@ -311,8 +311,8 @@ class SFXPlayer {
timeup: 'sfx/timeup.ogg', timeup: 'sfx/timeup.ogg',
// https://jummbus.bitbucket.io/#j2N03winn200s0k0l00e00t2wm9a3g00j07i0r1O_U00o32T0v0EL0OD0Ou00q1d1f5y1z1C2w1c2h0T0v0pL0OD0Ou00q0d1f2y1z2C0w2c3h0b4gp1xFyW4xo31pe0MaCHCbwLbM5cFDgapBOyY0 // https://jummbus.bitbucket.io/#j2N03winn200s0k0l00e00t2wm9a3g00j07i0r1O_U00o32T0v0EL0OD0Ou00q1d1f5y1z1C2w1c2h0T0v0pL0OD0Ou00q0d1f2y1z2C0w2c3h0b4gp1xFyW4xo31pe0MaCHCbwLbM5cFDgapBOyY0
win: 'sfx/win.ogg', win: 'sfx/win.ogg',
//from Ableton Retro Synths //from Ableton Retro Synths
'revive': 'sfx/revive.ogg', 'revive': 'sfx/revive.ogg',
}; };
for (let [name, path] of Object.entries(this.sound_sources)) { for (let [name, path] of Object.entries(this.sound_sources)) {

View File

@ -1036,8 +1036,8 @@ export const LL_TILESET_LAYOUT = Object.assign({}, CC2_TILESET_LAYOUT, {
terraformer_s: [2, 43], terraformer_s: [2, 43],
terraformer_w: [3, 43], terraformer_w: [3, 43],
global_cycler: [4, 43], global_cycler: [4, 43],
halo: [5, 43], halo: [5, 43],
fire_sticks: [6, 43], fire_sticks: [6, 43],
}); });

View File

@ -681,7 +681,7 @@ const TILE_TYPES = {
blocks_collision: COLLISION.block_cc1 | COLLISION.block_cc2, blocks_collision: COLLISION.block_cc1 | COLLISION.block_cc2,
speed_factor: 0.5, speed_factor: 0.5,
}, },
fire_sticks: { fire_sticks: {
layer: LAYERS.terrain, layer: LAYERS.terrain,
blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover & ~COLLISION.fireball), blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover & ~COLLISION.fireball),
blocks(me, level, other) { blocks(me, level, other) {
@ -692,14 +692,14 @@ const TILE_TYPES = {
// Bizarre interaction // Bizarre interaction
if (other.type.name === 'ghost' && ! other.has_item('hiking_boots')) if (other.type.name === 'ghost' && ! other.has_item('hiking_boots'))
return; return;
if (other.type.name === 'fireball') if (other.type.name === 'fireball')
{ {
level.transmute_tile(me, 'fire'); level.transmute_tile(me, 'fire');
} }
else else
{ {
level.transmute_tile(me, 'floor'); level.transmute_tile(me, 'floor');
} }
if (other === level.player) { if (other === level.player) {
level.sfx.play_once('step-gravel', me.cell); level.sfx.play_once('step-gravel', me.cell);
} }
@ -1652,108 +1652,108 @@ const TILE_TYPES = {
me.type.activate(me, level); me.type.activate(me, level);
}, },
}, },
global_cycler: { global_cycler: {
layer: LAYERS.terrain, layer: LAYERS.terrain,
blocks_collision: COLLISION.real_player | COLLISION.block_cc1 | COLLISION.monster_solid, blocks_collision: COLLISION.real_player | COLLISION.block_cc1 | COLLISION.monster_solid,
activate(me, level) { activate(me, level) {
//learn about surrounding tiles //learn about surrounding tiles
//some logic: we ignore tiles with a 'no sign' on them. for items, we ignore itemless tiles. if the same terrain/item is twice in a row, it stays the same. tiles next to global cycles aren't touched. //some logic: we ignore tiles with a 'no sign' on them. for items, we ignore itemless tiles. if the same terrain/item is twice in a row, it stays the same. tiles next to global cycles aren't touched.
let cells = [level.cell( let cells = [level.cell(
(me.cell.x + 0 + level.width) % level.width, (me.cell.x + 0 + level.width) % level.width,
(me.cell.y - 1 + level.height) % level.height), (me.cell.y - 1 + level.height) % level.height),
level.cell( level.cell(
(me.cell.x + 1 + level.width) % level.width, (me.cell.x + 1 + level.width) % level.width,
(me.cell.y + 0 + level.height) % level.height), (me.cell.y + 0 + level.height) % level.height),
level.cell( level.cell(
(me.cell.x + 0 + level.width) % level.width, (me.cell.x + 0 + level.width) % level.width,
(me.cell.y + 1 + level.height) % level.height), (me.cell.y + 1 + level.height) % level.height),
level.cell( level.cell(
(me.cell.x - 1 + level.width) % level.width, (me.cell.x - 1 + level.width) % level.width,
(me.cell.y + 0 + level.height) % level.height)].filter(x => x.get_item_mod()?.type.name != 'no_sign'); (me.cell.y + 0 + level.height) % level.height)].filter(x => x.get_item_mod()?.type.name != 'no_sign');
let terrains = cells.map(x => x.get_terrain().type.name); let terrains = cells.map(x => x.get_terrain().type.name);
let items = cells.map(x => x.get_item()?.type.name ?? null).filter(x => x != null); let items = cells.map(x => x.get_item()?.type.name ?? null).filter(x => x != null);
//globally cycle terrain //globally cycle terrain
if (terrains[0] != terrains[1] if (terrains[0] != terrains[1]
|| terrains[1] != terrains[2] || terrains[1] != terrains[2]
|| terrains[2] != terrains[3] || terrains[2] != terrains[3]
|| terrains[3] != terrains[0]) || terrains[3] != terrains[0])
{ {
for (var i = 0; i < level.width; ++i) for (var i = 0; i < level.width; ++i)
{ {
for (var j = 0; j < level.height; ++j) for (var j = 0; j < level.height; ++j)
{ {
let target_safe = [level.cell( let target_safe = [level.cell(
(i + 0 + level.width) % level.width, (i + 0 + level.width) % level.width,
(j - 1 + level.height) % level.height), (j - 1 + level.height) % level.height),
level.cell( level.cell(
(i + 1 + level.width) % level.width, (i + 1 + level.width) % level.width,
(j + 0 + level.height) % level.height), (j + 0 + level.height) % level.height),
level.cell( level.cell(
(i + 0 + level.width) % level.width, (i + 0 + level.width) % level.width,
(j + 1 + level.height) % level.height), (j + 1 + level.height) % level.height),
level.cell( level.cell(
(i- 1 + level.width) % level.width, (i- 1 + level.width) % level.width,
(j + 0 + level.height) % level.height)].filter(x => x.get_terrain().type.name == 'global_cycler'); (j + 0 + level.height) % level.height)].filter(x => x.get_terrain().type.name == 'global_cycler');
if (target_safe.length > 0) if (target_safe.length > 0)
{ {
continue; continue;
} }
let thing = level.cell(i, j).get_terrain(); let thing = level.cell(i, j).get_terrain();
let things = terrains; let things = terrains;
for (var k = 0; k < things.length; ++k) for (var k = 0; k < things.length; ++k)
{ {
if (thing.type.name == things[k] && thing.type.name != things[(k - 1 + things.length) % things.length]) if (thing.type.name == things[k] && thing.type.name != things[(k - 1 + things.length) % things.length])
{ {
level.transmute_tile(thing, things[(k + 1) % things.length]); level.transmute_tile(thing, things[(k + 1) % things.length]);
break; break;
} }
} }
} }
} }
} }
//globally cycle items //globally cycle items
//some logic: we skip over itemless spots and if two items in the row are a same, then that item stays the same //some logic: we skip over itemless spots and if two items in the row are a same, then that item stays the same
if (new Set(items).size > 1) if (new Set(items).size > 1)
{ {
for (var i = 0; i < level.width; ++i) for (var i = 0; i < level.width; ++i)
{ {
for (var j = 0; j < level.height; ++j) for (var j = 0; j < level.height; ++j)
{ {
let target_safe = [level.cell( let target_safe = [level.cell(
(i + 0 + level.width) % level.width, (i + 0 + level.width) % level.width,
(j - 1 + level.height) % level.height), (j - 1 + level.height) % level.height),
level.cell( level.cell(
(i + 1 + level.width) % level.width, (i + 1 + level.width) % level.width,
(j + 0 + level.height) % level.height), (j + 0 + level.height) % level.height),
level.cell( level.cell(
(i + 0 + level.width) % level.width, (i + 0 + level.width) % level.width,
(j + 1 + level.height) % level.height), (j + 1 + level.height) % level.height),
level.cell( level.cell(
(i- 1 + level.width) % level.width, (i- 1 + level.width) % level.width,
(j + 0 + level.height) % level.height)].filter(x => x.get_terrain().type.name == 'global_cycler'); (j + 0 + level.height) % level.height)].filter(x => x.get_terrain().type.name == 'global_cycler');
if (target_safe.length > 0) if (target_safe.length > 0)
{ {
continue; continue;
} }
let thing = level.cell(i, j).get_item(); let thing = level.cell(i, j).get_item();
let things = items; let things = items;
if (thing == null) if (thing == null)
{ {
continue; continue;
} }
for (var k = 0; k < things.length; ++k) for (var k = 0; k < things.length; ++k)
{ {
if (thing.type.name == things[k] && thing.type.name != things[(k - 1 + things.length) % things.length]) if (thing.type.name == things[k] && thing.type.name != things[(k - 1 + things.length) % things.length])
{ {
level.transmute_tile(thing, things[(k + 1) % things.length]); level.transmute_tile(thing, things[(k + 1) % things.length]);
break; break;
} }
} }
} }
} }
} }
}, },
// Also activates on rising pulse or gray button // Also activates on rising pulse or gray button
on_power(me, level) { on_power(me, level) {
@ -1762,7 +1762,7 @@ const TILE_TYPES = {
on_gray_button(me, level) { on_gray_button(me, level) {
me.type.activate(me, level); me.type.activate(me, level);
}, },
}, },
// Buttons // Buttons
button_blue: { button_blue: {
layer: LAYERS.terrain, layer: LAYERS.terrain,
@ -2758,7 +2758,7 @@ const TILE_TYPES = {
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),
}, },
halo: { halo: {
layer: LAYERS.item, layer: LAYERS.item,
is_item: true, is_item: true,
is_tool: true, is_tool: true,