From 93379c8826034601bbaad017366ddd2e484574e3 Mon Sep 17 00:00:00 2001
From: eug-vs <eugene@eug-vs.xyz>
Date: Sun, 13 Mar 2022 01:26:21 +0300
Subject: feat: add position calculation on attach

---
 src/Tile/TileOnBoard.ts | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

(limited to 'src/Tile')

diff --git a/src/Tile/TileOnBoard.ts b/src/Tile/TileOnBoard.ts
index 374ae95..bc1e66d 100644
--- a/src/Tile/TileOnBoard.ts
+++ b/src/Tile/TileOnBoard.ts
@@ -2,14 +2,13 @@ import _ from 'lodash';
 import Tile, { Feature, Direction } from './Tile';
 
 export interface Attachment {
-  attachTo: Tile;
+  attachTo: TileOnBoard;
   side: Direction;
   tile: Tile;
-  rotation: number; // Clockwise rotation of a tile
+  orientation: number; // Clockwise rotation of a tile
 }
 
 export default class TileOnBoard extends Tile {
-  neighbors: [Tile, Tile, Tile, Tile];
   orientation: number; // amount of 90-degree counter-clockwise rotations from original orientation
   position: {
     x: number;
@@ -26,7 +25,6 @@ export default class TileOnBoard extends Tile {
     super(center, sides, shield);
     this.position = position;
     this.orientation = orientation;
-    this.neighbors = [null, null, null, null];
   }
 
   getSide(direction: Direction) {
@@ -52,9 +50,4 @@ export default class TileOnBoard extends Tile {
         }))
     }));
   }
-
-  attach(tile: Tile, side: Direction) {
-    if (this.neighbors[side]) throw new Error('There is something already attached to this side!');
-    this.neighbors[side] = tile;
-  }
 }
-- 
cgit v1.2.3