Spaces:
Running
Running
File size: 1,083 Bytes
4ee4376 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
import tile from './tile';
import * as CONST from '../../constants';
export default class rail extends tile {
constructor (options) {
options.type = CONST.T_RAIL;
options.layerDepth = CONST.DEPTH_RAIL;
super(options);
}
check () {
if (!super.check()) return false;
if (![44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,71,72,90,91,108,109,110,111].includes(this.id)) return false;
return true;
}
get (id) {
let tile = super.get(id);
if (this.cell.position.rotate && tile?.flip)
this.props.flip = true;
if (this.props.flip && tile?.flipMode == CONST.ALTERNATE_TILE)
tile = super.get(tile.rotate[this.rotation]);
return tile;
}
create () {
if (!this.props.draw) return;
if (this.cell.position.underwater)
this.props.offsetY -= this.cell.position.seaLevel;
if (this.cell.tiles.has(CONST.T_TERRAIN) && this.cell.tiles.getId(CONST.T_TERRAIN) == 269)
this.props.offsetY -= CONST.LAYER_OFFSET;
super.create();
if (this.props.flip)
this.sprite.setFlipX(true);
}
} |