|
@@ -6,7 +6,7 @@ import { dieNormal, random, randomBetweenInclusive, randomChoice, shuffle } from
|
|
|
import { registerAI } from '$lib/simulate';
|
|
|
import { Entrance, doorTemplate, entranceQuery } from './door';
|
|
|
import { humanTemplate } from './human';
|
|
|
-import { drawRectangle, fillRectangle, floorTemplate, spawnNearby, spawnVault, vault } from './mapgen';
|
|
|
+import { drawRectangle, fillRectangle, floorTemplate, spawnNearby, spawnVault, spawnVaultRandom, vault } from './mapgen';
|
|
|
import { Mission, registerMissionTemplate } from './mission';
|
|
|
import { TalkNPC, registerTalkNPC } from './npc';
|
|
|
import { stairDownTemplate, stairUpTemplate } from './stairs';
|
|
@@ -65,7 +65,6 @@ registerMissionTemplate('intro', {
|
|
|
|
|
|
const lobbyFloor = {
|
|
|
generate: (world, z, width, height, stairwells) => {
|
|
|
- console.log('lobby');
|
|
|
if (stairwells !== undefined) {
|
|
|
console.error("Lobby isn't supposed to have predefined stairwell positions!");
|
|
|
return;
|
|
@@ -74,12 +73,12 @@ const lobbyFloor = {
|
|
|
drawRectangle(world, wallTemplate, 0, 0, width-1, height-1, z);
|
|
|
const [x, y] = placeEntrance(world, width, height, z);
|
|
|
spawnNearby(world, introRecruiterTemplate, x, y, z);
|
|
|
- spawnVault(world, stairwell0VaultTemplate, 1, 1, width-2, height-2, z);
|
|
|
+ const result = spawnVaultRandom(world, stairwell0VaultTemplate, 1, 1, width-2, height-2, z);
|
|
|
// const stairwell = stairwells[0];
|
|
|
// placeMainEntrance()
|
|
|
// placeBackEntrance()
|
|
|
// connectRooms()
|
|
|
- return ;
|
|
|
+ return result;
|
|
|
},
|
|
|
};
|
|
|
|
|
@@ -113,14 +112,19 @@ const stairwell0VaultTemplate = vault(`
|
|
|
#< ##
|
|
|
# +
|
|
|
#####
|
|
|
-`, mapping);
|
|
|
+`, mapping, {
|
|
|
+ toReturn: '<',
|
|
|
+});
|
|
|
|
|
|
const stairwellVaultTemplate = vault(`
|
|
|
####
|
|
|
#<>##
|
|
|
# +
|
|
|
#####
|
|
|
-`, mapping);
|
|
|
+`, mapping, {
|
|
|
+ toReturn: '<',
|
|
|
+ anchor: [1, 1],
|
|
|
+});
|
|
|
|
|
|
const introRecruiterTemplate = mergeTemplates(humanTemplate, [
|
|
|
[AI],
|
|
@@ -150,11 +154,20 @@ registerTalkNPC('introRecruiter', [
|
|
|
const bossFloor = {
|
|
|
minSize: [30, 30],
|
|
|
maxSize: [50, 80],
|
|
|
- generate: (world, z, width, height, stairwells) => {
|
|
|
+ generate: (world, z, width, height, stairwell) => {
|
|
|
},
|
|
|
};
|
|
|
|
|
|
const officeFloor = {
|
|
|
- generate: (world, z, width, height, stairwells) => {
|
|
|
+ generate: (world, z, width, height, stairwell) => {
|
|
|
+ if (stairwell === undefined) {
|
|
|
+ console.error("Non-lobby floor should have predefined stairwell positions!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ fillRectangle(world, floorTemplate, 0, 0, width-1, height-1, z);
|
|
|
+ drawRectangle(world, wallTemplate, 0, 0, width-1, height-1, z);
|
|
|
+ const {x, y} = getPos3(stairwell);
|
|
|
+ const result = spawnVault(world, stairwellVaultTemplate, x, y, z);
|
|
|
+ return result;
|
|
|
},
|
|
|
};
|