commit
This commit is contained in:
@@ -106,7 +106,6 @@ export class TileMap {
|
|||||||
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];
|
||||||
console.log(tile);
|
|
||||||
errorCount += tile[charType] === undefined;
|
errorCount += tile[charType] === undefined;
|
||||||
result += tile[charType] ?? undefinedCharPlaceholder;
|
result += tile[charType] ?? undefinedCharPlaceholder;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,9 +171,7 @@ export class Tile {
|
|||||||
|
|
||||||
const other = shallowCopy(TileTypes[this.disguiseAs]);
|
const other = shallowCopy(TileTypes[this.disguiseAs]);
|
||||||
for (const [pKey, pVal] of Object.entries(other)) {
|
for (const [pKey, pVal] of Object.entries(other)) {
|
||||||
if (this.key !== undefined) {
|
this[pKey] ??= pVal;
|
||||||
this[pKey] = pVal;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,9 +191,7 @@ export class Tile {
|
|||||||
//
|
//
|
||||||
const other = shallowCopy(TileTypes[this.is]);
|
const other = shallowCopy(TileTypes[this.is]);
|
||||||
for (const [pKey, pVal] of Object.entries(other)) {
|
for (const [pKey, pVal] of Object.entries(other)) {
|
||||||
if (this.key !== undefined) {
|
this[pKey] ??= pVal;
|
||||||
this[pKey] = pVal;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,8 +225,14 @@ export class Tile {
|
|||||||
mustBe(this.portalTargetId, "number", "string");
|
mustBe(this.portalTargetId, "number", "string");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.minimapChar ??= this.typeId;
|
if (this.minimapChar === undefined) {
|
||||||
this.revealedMinimapChar ??= this.minimapChar;
|
console.debug("minimap = typeid", { ...this });
|
||||||
|
this.minimapChar = this.typeId;
|
||||||
|
}
|
||||||
|
if (this.revealedMinimapChar === undefined) {
|
||||||
|
console.debug("reveaked = minimap", { ...this });
|
||||||
|
this.revealedMinimapChar = this.minimapChar;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @returns {Tile} */
|
/** @returns {Tile} */
|
||||||
@@ -279,20 +281,21 @@ export class Tile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let optionPos = 0;
|
let optionPos = 0;
|
||||||
const creationArgs = {};
|
const properties = {};
|
||||||
const getOption = (name) => options.getValue(name, optionPos++);
|
const getOption = (name) => options.getValue(name, optionPos++);
|
||||||
for (let [key, val] of Object.entries(prototype)) {
|
for (let [key, val] of Object.entries(prototype)) {
|
||||||
|
properties[key] = val;
|
||||||
//
|
//
|
||||||
const fetchFromOption = typeof val === "symbol" && val.description.startsWith("REQUIRED_");
|
const fetchOption = typeof val === "symbol" && val.description.startsWith("REQUIRED_");
|
||||||
|
|
||||||
creationArgs[key] = fetchFromOption ? getOption(key) : shallowCopy(val);
|
properties[key] = fetchOption ? getOption(key) : shallowCopy(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Tile(typeId, creationArgs);
|
return new Tile(typeId, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
clone() {
|
clone() {
|
||||||
return new Tile(this.typeId, this);
|
return new Tile(this.typeId, { ...this });
|
||||||
}
|
}
|
||||||
|
|
||||||
isWallLike() {
|
isWallLike() {
|
||||||
|
|||||||
Reference in New Issue
Block a user