Skip to content

Commit

Permalink
started outlining new POC map, shuffled around config datas and remov…
Browse files Browse the repository at this point in the history
…ed isFirstLight thing from backrooms
  • Loading branch information
meszaros-lajos-gyorgy committed Feb 27, 2022
1 parent 2a15503 commit 5f87864
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 11 deletions.
12 changes: 9 additions & 3 deletions src/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const seedrandom = require("seedrandom");

const aliasNightmare = require("./projects/alias-nightmare/index.js");
const theBackrooms = require("./projects/the-backrooms/index.js");
const theLake = require("./projects/the-lake/index.js");

(async () => {
// const seed = Math.floor(Math.random() * 1e20);
Expand All @@ -14,17 +15,18 @@ const theBackrooms = require("./projects/the-backrooms/index.js");
levelIdx: 1,
seed,
lootTable: [],
bumpFactor: 3,
};

const project = "alias-nightmare";
const project = "the-backrooms";

switch (project) {
case "the-backrooms":
await theBackrooms({
...config,
numberOfRooms: 10,
roomDimensions: { width: [1, 5], depth: [1, 5], height: 2 },
percentOfLightsOn: 60,
percentOfLightsOn: 0,
lootTable: [
{
name: "almondWater",
Expand All @@ -47,7 +49,11 @@ const theBackrooms = require("./projects/the-backrooms/index.js");
case "alias-nightmare":
await aliasNightmare({
...config,
bumpFactor: 3,
});
break;
case "the-lake":
await theLake({
...config,
});
break;
}
Expand Down
8 changes: 0 additions & 8 deletions src/projects/the-backrooms/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,8 +675,6 @@ const generate = async (config) => {

const lamps = [];

let isFirstLamp = true;

for (let y = 0; y < grid.length; y++) {
for (let x = 0; x < grid[y].length; x++) {
if (isOccupied(x, y, grid)) {
Expand All @@ -690,11 +688,6 @@ const generate = async (config) => {
on: randomBetween(0, 100) < config.percentOfLightsOn,
};

if (isFirstLamp) {
isFirstLamp = false;
lampConfig.on = true;
}

const lamp = addLamp(
[
left + x * UNIT - 50 + offsetX,
Expand Down Expand Up @@ -780,7 +773,6 @@ const generate = async (config) => {
},

renderGrid(grid),

setColor("#0b0c10"),

addZone(
Expand Down
79 changes: 79 additions & 0 deletions src/projects/the-lake/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
const { compose } = require("ramda");
const { ambiences } = require("../../assets/ambiences");
const {
items,
createItem,
moveTo,
markAsUsed,
addScript,
} = require("../../assets/items");
const { textures } = require("../../assets/textures");
const {
saveToDisk,
finalize,
generateBlankMapData,
movePlayerTo,
addZone,
setColor,
setTexture,
} = require("../../helpers");
const { plain } = require("../../prefabs");
const { disableBumping } = require("../../prefabs/plain");
const { getInjections } = require("../../scripting");

const createWelcomeMarker = (pos) => (config) => {
return compose(
markAsUsed,
moveTo(pos, [0, 0, 0]),
addScript((self) => {
return `
// component: welcomeMarker
ON INIT {
${getInjections("init", self)}
SETCONTROLLEDZONE palette0
ACCEPT
}
ON CONTROLLEDZONE_ENTER {
TELEPORT -p ${self.ref}
ACCEPT
}
`;
}),
createItem
)(items.marker);
};

const generate = async (config) => {
const { origin } = config;

const welcomeMarker = createWelcomeMarker([0, 0, 0])(config);

return compose(
saveToDisk,
finalize,

plain([0, 0, 0], [10, 10], "floor"),
setTexture(textures.gravel.ground1),
setColor("lime"),

addZone(
[-origin[0], 0, -origin[2]],
[100, 0, 100],
"palette0",
ambiences.none,
5000
),
setColor("#DBF4FF"),

movePlayerTo([-origin[0], 0, -origin[2]]),
(mapData) => {
mapData.meta.mapName = "The Lake";
return mapData;
},

generateBlankMapData
)(config);
};

module.exports = generate;

0 comments on commit 5f87864

Please sign in to comment.