Clean up logs and fix variant reference error
This commit is contained in:
@@ -41,7 +41,7 @@ export class DungeonGenerator {
|
||||
}
|
||||
|
||||
this.placeCardFinal(firstCard, 0, 0, DIRECTIONS.NORTH);
|
||||
console.log(`🏰 Dungeon started with ${firstCard.name}`);
|
||||
|
||||
|
||||
// 2. Transition to door selection
|
||||
this.state = PLACEMENT_STATE.WAITING_DOOR;
|
||||
@@ -52,9 +52,7 @@ export class DungeonGenerator {
|
||||
* Player selects a door to expand from
|
||||
*/
|
||||
selectDoor(exitPoint) {
|
||||
console.log('[DungeonGenerator] selectDoor called with:', exitPoint);
|
||||
console.log('[DungeonGenerator] Current state:', this.state);
|
||||
console.log('[DungeonGenerator] Available exits:', this.availableExits);
|
||||
|
||||
|
||||
if (this.state !== PLACEMENT_STATE.WAITING_DOOR) {
|
||||
console.warn("Not in door selection mode");
|
||||
@@ -81,7 +79,7 @@ export class DungeonGenerator {
|
||||
// Draw next card
|
||||
this.currentCard = this.deck.draw();
|
||||
if (!this.currentCard) {
|
||||
console.log("Deck empty - dungeon complete");
|
||||
|
||||
this.state = PLACEMENT_STATE.COMPLETE;
|
||||
this.notifyStateChange();
|
||||
return false;
|
||||
@@ -113,7 +111,7 @@ export class DungeonGenerator {
|
||||
this.notifyPlacementUpdate();
|
||||
this.notifyStateChange();
|
||||
|
||||
console.log(`📦 Placing ${this.currentCard.name} at (${this.placementX}, ${this.placementY})`);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -127,7 +125,7 @@ export class DungeonGenerator {
|
||||
const currentIndex = rotations.indexOf(this.placementRotation);
|
||||
this.placementRotation = rotations[(currentIndex + 1) % 4];
|
||||
|
||||
console.log(`🔄 Rotated to ${this.placementRotation}`);
|
||||
|
||||
this.notifyPlacementUpdate();
|
||||
}
|
||||
|
||||
@@ -140,7 +138,7 @@ export class DungeonGenerator {
|
||||
this.placementX += dx;
|
||||
this.placementY += dy;
|
||||
|
||||
console.log(`↔️ Moved to (${this.placementX}, ${this.placementY})`);
|
||||
|
||||
this.notifyPlacementUpdate();
|
||||
}
|
||||
|
||||
@@ -168,13 +166,13 @@ export class DungeonGenerator {
|
||||
return false;
|
||||
}
|
||||
|
||||
console.log(`[confirmPlacement] Placing at (${this.placementX}, ${this.placementY}) rotation: ${this.placementRotation}`);
|
||||
|
||||
|
||||
// Round to integers (tiles must be on grid cells)
|
||||
const finalX = Math.round(this.placementX);
|
||||
const finalY = Math.round(this.placementY);
|
||||
|
||||
console.log(`[confirmPlacement] Rounded to (${finalX}, ${finalY})`);
|
||||
|
||||
|
||||
// Place the tile
|
||||
this.placeCardFinal(
|
||||
@@ -191,7 +189,7 @@ export class DungeonGenerator {
|
||||
|
||||
this.notifyPlacementUpdate(); // Clear preview
|
||||
this.notifyStateChange();
|
||||
console.log("✅ Tile placed successfully");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -199,12 +197,7 @@ export class DungeonGenerator {
|
||||
* Internal: Actually place a card on the grid
|
||||
*/
|
||||
placeCardFinal(card, x, y, rotation) {
|
||||
console.log('[placeCardFinal] Card:', card);
|
||||
console.log('[placeCardFinal] Card.variants:', card.variants);
|
||||
console.log('[placeCardFinal] Rotation:', rotation, 'Type:', typeof rotation);
|
||||
|
||||
const variant = card.variants[rotation];
|
||||
console.log('[placeCardFinal] Variant:', variant);
|
||||
|
||||
const instance = {
|
||||
id: `tile_${this.placedTiles.length}`,
|
||||
@@ -224,9 +217,7 @@ export class DungeonGenerator {
|
||||
* Update list of exits player can choose from
|
||||
*/
|
||||
updateAvailableExits(instance, variant, anchorX, anchorY) {
|
||||
console.log('[updateAvailableExits] ===== NUEVO CODIGO ===== Called for tile:', instance.id);
|
||||
console.log('[updateAvailableExits] Variant exits:', variant.exits);
|
||||
console.log('[updateAvailableExits] Anchor:', anchorX, anchorY);
|
||||
|
||||
|
||||
// Add new exits from this tile
|
||||
for (const ex of variant.exits) {
|
||||
@@ -236,7 +227,7 @@ export class DungeonGenerator {
|
||||
const leadingTo = this.neighbor(gx, gy, ex.direction);
|
||||
const isOccupied = this.grid.isOccupied(leadingTo.x, leadingTo.y);
|
||||
|
||||
console.log(`[updateAvailableExits] Exit at (${gx}, ${gy}) dir ${ex.direction} -> leads to (${leadingTo.x}, ${leadingTo.y}) occupied: ${isOccupied}`);
|
||||
|
||||
|
||||
if (!isOccupied) {
|
||||
this.availableExits.push({
|
||||
@@ -245,11 +236,11 @@ export class DungeonGenerator {
|
||||
direction: ex.direction,
|
||||
tileId: instance.id
|
||||
});
|
||||
console.log('[updateAvailableExits] ✓ Added exit');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
console.log('[updateAvailableExits] Total available exits now:', this.availableExits.length);
|
||||
|
||||
|
||||
// Remove exits that are now blocked or connected
|
||||
this.availableExits = this.availableExits.filter(exit => {
|
||||
|
||||
Reference in New Issue
Block a user