spaceify
This commit is contained in:
parent
e134b4cbd9
commit
0100f1e12c
@ -799,67 +799,67 @@ const TILE_ENCODING = {
|
||||
extra_args: [arg_direction],
|
||||
is_extension: true,
|
||||
},
|
||||
0xe2: {
|
||||
0xe2: {
|
||||
name: 'skeleton_key',
|
||||
has_next: true,
|
||||
is_extension: true,
|
||||
},
|
||||
0xe2: {
|
||||
0xe2: {
|
||||
name: 'gate_red',
|
||||
has_next: true,
|
||||
is_extension: true,
|
||||
},
|
||||
0xe3: {
|
||||
0xe3: {
|
||||
name: 'gate_blue',
|
||||
has_next: true,
|
||||
is_extension: true,
|
||||
},
|
||||
0xe4: {
|
||||
0xe4: {
|
||||
name: 'gate_yellow',
|
||||
has_next: true,
|
||||
is_extension: true,
|
||||
},
|
||||
0xe5: {
|
||||
0xe5: {
|
||||
name: 'gate_green',
|
||||
has_next: true,
|
||||
is_extension: true,
|
||||
},
|
||||
0xe6: {
|
||||
0xe6: {
|
||||
name: 'sand',
|
||||
has_next: true,
|
||||
is_extension: true,
|
||||
},
|
||||
0xe7: {
|
||||
0xe7: {
|
||||
name: 'terraformer_n',
|
||||
has_next: true,
|
||||
is_extension: true,
|
||||
},
|
||||
0xe8: {
|
||||
0xe8: {
|
||||
name: 'terraformer_e',
|
||||
has_next: true,
|
||||
is_extension: true,
|
||||
},
|
||||
0xe9: {
|
||||
0xe9: {
|
||||
name: 'terraformer_s',
|
||||
has_next: true,
|
||||
is_extension: true,
|
||||
},
|
||||
0xea: {
|
||||
0xea: {
|
||||
name: 'terraformer_w',
|
||||
has_next: true,
|
||||
is_extension: true,
|
||||
},
|
||||
0xeb: {
|
||||
0xeb: {
|
||||
name: 'global_cycler',
|
||||
has_next: true,
|
||||
is_extension: true,
|
||||
},
|
||||
0xec: {
|
||||
0xec: {
|
||||
name: 'halo',
|
||||
has_next: true,
|
||||
is_extension: true,
|
||||
},
|
||||
0xed: {
|
||||
0xed: {
|
||||
name: 'fire_sticks',
|
||||
has_next: true,
|
||||
is_extension: true,
|
||||
|
||||
40
js/game.js
40
js/game.js
@ -2278,26 +2278,26 @@ export class Level extends LevelInterface {
|
||||
if (player === null) {
|
||||
player = this.player;
|
||||
}
|
||||
|
||||
if (this.take_tool_from_actor(player, 'halo')) {
|
||||
this.sfx.play_once('revive');
|
||||
if (reason === 'time')
|
||||
{
|
||||
this.pause_timer();
|
||||
}
|
||||
else if (killer !== null)
|
||||
{
|
||||
if (killer.type.is_actor || killer.type.is_item)
|
||||
{
|
||||
this.remove_tile(killer);
|
||||
}
|
||||
else //presumably terrain
|
||||
{
|
||||
this.transmute_tile(killer, 'floor');
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.take_tool_from_actor(player, 'halo')) {
|
||||
this.sfx.play_once('revive');
|
||||
if (reason === 'time')
|
||||
{
|
||||
this.pause_timer();
|
||||
}
|
||||
else if (killer !== null)
|
||||
{
|
||||
if (killer.type.is_actor || killer.type.is_item)
|
||||
{
|
||||
this.remove_tile(killer);
|
||||
}
|
||||
else //presumably terrain
|
||||
{
|
||||
this.transmute_tile(killer, 'floor');
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this._push_pending_undo(() => {
|
||||
this.fail_reason = null;
|
||||
|
||||
@ -1600,8 +1600,8 @@ const EDITOR_PALETTE = [{
|
||||
'sand',
|
||||
'terraformer_n',
|
||||
'global_cycler',
|
||||
'halo',
|
||||
'fire_sticks',
|
||||
'halo',
|
||||
'fire_sticks',
|
||||
],
|
||||
}];
|
||||
|
||||
@ -2184,14 +2184,14 @@ const EDITOR_TILE_DESCRIPTIONS = {
|
||||
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.",
|
||||
},
|
||||
halo: {
|
||||
name: "Halo",
|
||||
desc: "Protects the player from death once, destroying the would-be killer in the process.",
|
||||
},
|
||||
fire_sticks: {
|
||||
name: "Dormant Lava",
|
||||
desc: "Acts like dirt. However, fireballs will enter it and turn it into Fire in the process.",
|
||||
},
|
||||
halo: {
|
||||
name: "Halo",
|
||||
desc: "Protects the player from death once, destroying the would-be killer in the process.",
|
||||
},
|
||||
fire_sticks: {
|
||||
name: "Dormant Lava",
|
||||
desc: "Acts like dirt. However, fireballs will enter it and turn it into Fire in the process.",
|
||||
},
|
||||
};
|
||||
|
||||
const SPECIAL_PALETTE_ENTRIES = {
|
||||
|
||||
@ -311,8 +311,8 @@ class SFXPlayer {
|
||||
timeup: 'sfx/timeup.ogg',
|
||||
// https://jummbus.bitbucket.io/#j2N03winn200s0k0l00e00t2wm9a3g00j07i0r1O_U00o32T0v0EL0OD0Ou00q1d1f5y1z1C2w1c2h0T0v0pL0OD0Ou00q0d1f2y1z2C0w2c3h0b4gp1xFyW4xo31pe0MaCHCbwLbM5cFDgapBOyY0
|
||||
win: 'sfx/win.ogg',
|
||||
//from Ableton Retro Synths
|
||||
'revive': 'sfx/revive.ogg',
|
||||
//from Ableton Retro Synths
|
||||
'revive': 'sfx/revive.ogg',
|
||||
};
|
||||
|
||||
for (let [name, path] of Object.entries(this.sound_sources)) {
|
||||
|
||||
@ -1036,8 +1036,8 @@ export const LL_TILESET_LAYOUT = Object.assign({}, CC2_TILESET_LAYOUT, {
|
||||
terraformer_s: [2, 43],
|
||||
terraformer_w: [3, 43],
|
||||
global_cycler: [4, 43],
|
||||
halo: [5, 43],
|
||||
fire_sticks: [6, 43],
|
||||
halo: [5, 43],
|
||||
fire_sticks: [6, 43],
|
||||
|
||||
});
|
||||
|
||||
|
||||
220
js/tiletypes.js
220
js/tiletypes.js
@ -681,7 +681,7 @@ const TILE_TYPES = {
|
||||
blocks_collision: COLLISION.block_cc1 | COLLISION.block_cc2,
|
||||
speed_factor: 0.5,
|
||||
},
|
||||
fire_sticks: {
|
||||
fire_sticks: {
|
||||
layer: LAYERS.terrain,
|
||||
blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover & ~COLLISION.fireball),
|
||||
blocks(me, level, other) {
|
||||
@ -692,14 +692,14 @@ const TILE_TYPES = {
|
||||
// Bizarre interaction
|
||||
if (other.type.name === 'ghost' && ! other.has_item('hiking_boots'))
|
||||
return;
|
||||
if (other.type.name === 'fireball')
|
||||
{
|
||||
level.transmute_tile(me, 'fire');
|
||||
}
|
||||
else
|
||||
{
|
||||
level.transmute_tile(me, 'floor');
|
||||
}
|
||||
if (other.type.name === 'fireball')
|
||||
{
|
||||
level.transmute_tile(me, 'fire');
|
||||
}
|
||||
else
|
||||
{
|
||||
level.transmute_tile(me, 'floor');
|
||||
}
|
||||
if (other === level.player) {
|
||||
level.sfx.play_once('step-gravel', me.cell);
|
||||
}
|
||||
@ -1652,108 +1652,108 @@ const TILE_TYPES = {
|
||||
me.type.activate(me, level);
|
||||
},
|
||||
},
|
||||
global_cycler: {
|
||||
layer: LAYERS.terrain,
|
||||
global_cycler: {
|
||||
layer: LAYERS.terrain,
|
||||
blocks_collision: COLLISION.real_player | COLLISION.block_cc1 | COLLISION.monster_solid,
|
||||
activate(me, level) {
|
||||
//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.
|
||||
let cells = [level.cell(
|
||||
(me.cell.x + 0 + level.width) % level.width,
|
||||
(me.cell.y - 1 + level.height) % level.height),
|
||||
level.cell(
|
||||
(me.cell.x + 1 + level.width) % level.width,
|
||||
(me.cell.y + 0 + level.height) % level.height),
|
||||
level.cell(
|
||||
(me.cell.x + 0 + level.width) % level.width,
|
||||
(me.cell.y + 1 + level.height) % level.height),
|
||||
level.cell(
|
||||
(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');
|
||||
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);
|
||||
|
||||
//globally cycle terrain
|
||||
if (terrains[0] != terrains[1]
|
||||
|| terrains[1] != terrains[2]
|
||||
|| terrains[2] != terrains[3]
|
||||
|| terrains[3] != terrains[0])
|
||||
{
|
||||
for (var i = 0; i < level.width; ++i)
|
||||
{
|
||||
for (var j = 0; j < level.height; ++j)
|
||||
{
|
||||
let target_safe = [level.cell(
|
||||
(i + 0 + level.width) % level.width,
|
||||
(j - 1 + level.height) % level.height),
|
||||
level.cell(
|
||||
(i + 1 + level.width) % level.width,
|
||||
(j + 0 + level.height) % level.height),
|
||||
level.cell(
|
||||
(i + 0 + level.width) % level.width,
|
||||
(j + 1 + level.height) % level.height),
|
||||
level.cell(
|
||||
(i- 1 + level.width) % level.width,
|
||||
(j + 0 + level.height) % level.height)].filter(x => x.get_terrain().type.name == 'global_cycler');
|
||||
if (target_safe.length > 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
let thing = level.cell(i, j).get_terrain();
|
||||
let things = terrains;
|
||||
for (var k = 0; k < things.length; ++k)
|
||||
{
|
||||
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]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//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
|
||||
if (new Set(items).size > 1)
|
||||
{
|
||||
for (var i = 0; i < level.width; ++i)
|
||||
{
|
||||
for (var j = 0; j < level.height; ++j)
|
||||
{
|
||||
let target_safe = [level.cell(
|
||||
(i + 0 + level.width) % level.width,
|
||||
(j - 1 + level.height) % level.height),
|
||||
level.cell(
|
||||
(i + 1 + level.width) % level.width,
|
||||
(j + 0 + level.height) % level.height),
|
||||
level.cell(
|
||||
(i + 0 + level.width) % level.width,
|
||||
(j + 1 + level.height) % level.height),
|
||||
level.cell(
|
||||
(i- 1 + level.width) % level.width,
|
||||
(j + 0 + level.height) % level.height)].filter(x => x.get_terrain().type.name == 'global_cycler');
|
||||
if (target_safe.length > 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
let thing = level.cell(i, j).get_item();
|
||||
let things = items;
|
||||
if (thing == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (var k = 0; k < things.length; ++k)
|
||||
{
|
||||
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]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//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(
|
||||
(me.cell.x + 0 + level.width) % level.width,
|
||||
(me.cell.y - 1 + level.height) % level.height),
|
||||
level.cell(
|
||||
(me.cell.x + 1 + level.width) % level.width,
|
||||
(me.cell.y + 0 + level.height) % level.height),
|
||||
level.cell(
|
||||
(me.cell.x + 0 + level.width) % level.width,
|
||||
(me.cell.y + 1 + level.height) % level.height),
|
||||
level.cell(
|
||||
(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');
|
||||
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);
|
||||
|
||||
//globally cycle terrain
|
||||
if (terrains[0] != terrains[1]
|
||||
|| terrains[1] != terrains[2]
|
||||
|| terrains[2] != terrains[3]
|
||||
|| terrains[3] != terrains[0])
|
||||
{
|
||||
for (var i = 0; i < level.width; ++i)
|
||||
{
|
||||
for (var j = 0; j < level.height; ++j)
|
||||
{
|
||||
let target_safe = [level.cell(
|
||||
(i + 0 + level.width) % level.width,
|
||||
(j - 1 + level.height) % level.height),
|
||||
level.cell(
|
||||
(i + 1 + level.width) % level.width,
|
||||
(j + 0 + level.height) % level.height),
|
||||
level.cell(
|
||||
(i + 0 + level.width) % level.width,
|
||||
(j + 1 + level.height) % level.height),
|
||||
level.cell(
|
||||
(i- 1 + level.width) % level.width,
|
||||
(j + 0 + level.height) % level.height)].filter(x => x.get_terrain().type.name == 'global_cycler');
|
||||
if (target_safe.length > 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
let thing = level.cell(i, j).get_terrain();
|
||||
let things = terrains;
|
||||
for (var k = 0; k < things.length; ++k)
|
||||
{
|
||||
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]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//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
|
||||
if (new Set(items).size > 1)
|
||||
{
|
||||
for (var i = 0; i < level.width; ++i)
|
||||
{
|
||||
for (var j = 0; j < level.height; ++j)
|
||||
{
|
||||
let target_safe = [level.cell(
|
||||
(i + 0 + level.width) % level.width,
|
||||
(j - 1 + level.height) % level.height),
|
||||
level.cell(
|
||||
(i + 1 + level.width) % level.width,
|
||||
(j + 0 + level.height) % level.height),
|
||||
level.cell(
|
||||
(i + 0 + level.width) % level.width,
|
||||
(j + 1 + level.height) % level.height),
|
||||
level.cell(
|
||||
(i- 1 + level.width) % level.width,
|
||||
(j + 0 + level.height) % level.height)].filter(x => x.get_terrain().type.name == 'global_cycler');
|
||||
if (target_safe.length > 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
let thing = level.cell(i, j).get_item();
|
||||
let things = items;
|
||||
if (thing == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (var k = 0; k < things.length; ++k)
|
||||
{
|
||||
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]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// Also activates on rising pulse or gray button
|
||||
on_power(me, level) {
|
||||
@ -1762,7 +1762,7 @@ const TILE_TYPES = {
|
||||
on_gray_button(me, level) {
|
||||
me.type.activate(me, level);
|
||||
},
|
||||
},
|
||||
},
|
||||
// Buttons
|
||||
button_blue: {
|
||||
layer: LAYERS.terrain,
|
||||
@ -2758,7 +2758,7 @@ const TILE_TYPES = {
|
||||
is_tool: true,
|
||||
blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover),
|
||||
},
|
||||
halo: {
|
||||
halo: {
|
||||
layer: LAYERS.item,
|
||||
is_item: true,
|
||||
is_tool: true,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user