Fugbixes
This commit is contained in:
@@ -25,7 +25,7 @@ import { Vector2i } from "./ascii_types.js";
|
|||||||
* @readonly @constant @enum {string}
|
* @readonly @constant @enum {string}
|
||||||
*/
|
*/
|
||||||
export const CharType = {
|
export const CharType = {
|
||||||
SYSTEM: "internalMapChar",
|
SYSTEM: "typeId",
|
||||||
MINIMAP: "minimapChar",
|
MINIMAP: "minimapChar",
|
||||||
MINIMAP_REVEALED: "revealedMinimapChar",
|
MINIMAP_REVEALED: "revealedMinimapChar",
|
||||||
};
|
};
|
||||||
@@ -100,10 +100,11 @@ export class TileMap {
|
|||||||
*/
|
*/
|
||||||
toString(charType = CharType.SYSTEM) {
|
toString(charType = CharType.SYSTEM) {
|
||||||
let result = "";
|
let result = "";
|
||||||
|
|
||||||
for (let y = 0; y < this.height; y++) {
|
for (let y = 0; y < this.height; y++) {
|
||||||
for (let x = 0; x < this.width; x++) {
|
for (let x = 0; x < this.width; x++) {
|
||||||
const tile = this.tiles[y][x];
|
const tile = this.tiles[y][x];
|
||||||
result += tile[charType];
|
result += tile[charType] ?? "Ø";
|
||||||
}
|
}
|
||||||
result += "\n";
|
result += "\n";
|
||||||
}
|
}
|
||||||
@@ -148,20 +149,20 @@ export class TileMap {
|
|||||||
return this.tiles[y][x].isWallLike();
|
return this.tiles[y][x].isWallLike();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {number} x
|
||||||
|
* @param {number} y
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
behavesLikeFloor(x, y) {
|
behavesLikeFloor(x, y) {
|
||||||
console.log("behavesLikeFloor???", { x, y });
|
|
||||||
x |= 0;
|
x |= 0;
|
||||||
y |= 0;
|
y |= 0;
|
||||||
|
|
||||||
if (x < 0 || x >= this.width || y < 0 || y >= this.height) {
|
if (x < 0 || x >= this.width || y < 0 || y >= this.height) {
|
||||||
console.log(" behavesLikeFloor: YES");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = this.tiles[y][x].isFloorlike();
|
return this.tiles[y][x].isFloorlike();
|
||||||
console.log(result ? " YES" : " NOPE");
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class DungeonGenerator {
|
|||||||
this.addPillarsToBigRooms();
|
this.addPillarsToBigRooms();
|
||||||
this.addFeatures();
|
this.addFeatures();
|
||||||
this.addPlayerStart();
|
this.addPlayerStart();
|
||||||
this.addPortals();
|
// this.addPortals();
|
||||||
return this.map.toString(CharType.MINIMAP_REVEALED);
|
return this.map.toString(CharType.MINIMAP_REVEALED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -425,11 +425,11 @@ window.generateDungeon = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
window.downloadDungeon = () => {
|
window.downloadDungeon = () => {
|
||||||
if (!currentDungeon) {
|
if (!window.currentDungeon) {
|
||||||
window.generateDungeon();
|
window.generateDungeon();
|
||||||
}
|
}
|
||||||
|
|
||||||
const blob = new Blob([currentDungeon], { type: "text/plain" });
|
const blob = new Blob([window.currentDungeon], { type: "text/plain" });
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
const a = document.createElement("a");
|
const a = document.createElement("a");
|
||||||
a.href = url;
|
a.href = url;
|
||||||
|
|||||||
Reference in New Issue
Block a user