// When pushed, moves in that direction until it hits a barrier. // NOTE. Unlike XOR, this CAN pass though squashable items. class Chair : Movable { @CostumeAttribute var rounded = false var dir = -1 override fun rounded( direction : int ) : boolean { return rounded && (direction == NORTH_EAST || direction == NORTH_WEST) } override fun myTurn() { if ( dir >= 0 ) { val next = look( dir ) if (canMove( next, dir )) { move( dir ) } else { dir = -1 // Stop moving } } } fun canMove( next : LookedAt, direction : int ) = next.squashable( direction ) override fun canPush( direction : int, strength : int , speed : int ) = (this.dir < 0) && canMove( look( direction, Math.max( speed, this.speed ) ), direction ) override fun push( direction : int, speed : int ) { dir = direction move( direction, Math.max( speed, this.speed ) ) } override fun copyable() = true }