fun: rocks

This commit is contained in:
cha0s 2021-03-28 17:52:18 -05:00
parent 35d77efc4c
commit 19d4c62ccf
3 changed files with 19 additions and 5 deletions

View File

@ -96,7 +96,7 @@ export default (latus) => class Universe extends JsonResource {
const {entity} = player;
const room = this.room(entity.currentRoom);
entity.stopInforming(room);
room.removeEntityFromLayer(entity, 2);
room.removeEntityFromLayer(entity, 3);
const index = this.#players.indexOf(player);
if (-1 !== index) {
this.#players.splice(player, 1);

View File

@ -28,6 +28,16 @@ const Plains = new Generator({
),
covers: ([x, y]) => noise(Vector.scale([x, y], 10)) < 0.2,
size: [w, h],
children: [
new Generator({
calculate: indexComputer(
[407, 408, 423, 424],
([x, y]) => noise(Vector.scale([x, y], 30)),
),
covers: ([x, y]) => noise(Vector.scale([y, x], 12)) < 0.5,
size: [w, h],
}),
],
}),
new Generator({
calculate: indexComputer(
@ -55,6 +65,10 @@ export default async (room, latus) => {
Plains.children[0].matrix,
);
room.layer(2).stampAt(
[0, 0, w, h],
Plains.children[0].children[0].matrix,
);
room.layer(3).stampAt(
[0, 0, w, h],
Plains.children[1].matrix,
);
@ -73,7 +87,7 @@ export default async (room, latus) => {
Vector.add([8, 8], Vector.scale([x, y], 16)),
[Math.random() * 8 - 4, Math.random() * 8 - 4],
)));
room.addEntityToLayer(shrub, 2);
room.addEntityToLayer(shrub, 3);
}
else if (v < 0.17) {
// eslint-disable-next-line no-await-in-loop
@ -85,7 +99,7 @@ export default async (room, latus) => {
Vector.add([8, 8], p),
[Math.random() * 8 - 4, Math.random() * 8 - 4],
)));
room.addEntityToLayer(tree, 2);
room.addEntityToLayer(tree, 3);
}
v = noise(Vector.scale([x, y], 9), seed + 1);
if (v < 0.08) {
@ -95,7 +109,7 @@ export default async (room, latus) => {
Vector.add([8, 8], Vector.scale([x, y], 16)),
[Math.random() * 8 - 4, Math.random() * 8 - 4],
)));
room.addEntityToLayer(flower, 2);
room.addEntityToLayer(flower, 3);
}
}
}

View File

@ -29,7 +29,7 @@ export default () => class Universed extends decorate(Trait) {
}
if (this.entity.currentRoom) {
const room = this.#universe.room(this.entity.currentRoom);
room.addEntityToLayer(this.entity, 2);
room.addEntityToLayer(this.entity, 3);
this.entity.startInforming(room);
}
}