示例#1
0
 def get_additional_blocks(self, block: Block, linked_blocks: Sequence[Block]) -> Tuple[PlacedBlock, ...]:
     assert len(linked_blocks) == 2
     left_side_lower_block, left_side_upper_block = linked_blocks
     right_side_mask = 0
     if left_side_lower_block.type == block.type and self._get_face(left_side_lower_block) == self._get_face(block):
         if not self._is_right_side(left_side_upper_block):
             right_side_mask = self._IS_RIGHT_SIDE_MASK
     data = self._IS_UPPER_MASK | right_side_mask
     return PlacedBlock(Vector3(0, 0, 0), block), PlacedBlock(Vector3(0, 1, 0), block.copy(data=data))
示例#2
0
 def get_additional_blocks(self, block: Block, linked_blocks: Sequence[Block]) -> Tuple[PlacedBlock, ...]:
     network = _RailNetwork(zip(_SURROUNDING, linked_blocks))
     data = self._get_block_data(network, block.type == BlockType.RAIL)
     blocks = [PlacedBlock(Vector3(0, 0, 0), block.copy(data=data))]
     rail_type = _RAIL_TYPE[data]
     for connector in rail_type.connector:
         updated = self._update_neighbour(network, connector)
         if updated:
             blocks.append(updated)
     return tuple(blocks)
示例#3
0
 def switch(self, block: Block) -> Block:
     block_type = BlockType.DAYLIGHT_DETECTOR_INVERTED \
         if block.type is BlockType.DAYLIGHT_DETECTOR else BlockType.DAYLIGHT_DETECTOR
     return block.copy(block_type=block_type)
示例#4
0
 def switch(self, block: Block) -> Block:
     return block.copy(data=block.data ^ self._TOGGLE_MASK)
示例#5
0
 def get_additional_blocks(self, block: Block, linked_blocks: Sequence[Block]) -> Tuple[PlacedBlock, ...]:
     assert len(linked_blocks) == 1
     base_side_block = linked_blocks[0]
     if base_side_block.type == block.type and base_side_block.data == block.data:
         block = block.copy(data=block.data ^ 1)
     return PlacedBlock(Vector3(0, 0, 0), block),
示例#6
0
 def switch(self, block: Block) -> Block:
     return block.copy(data=block.data ^ self._DOES_OPEN_MASK)
示例#7
0
 def get_additional_blocks(self, block: Block, linked_blocks: Sequence[Block]) -> Tuple[PlacedBlock, ...]:
     return PlacedBlock(Vector3(0, 0, 0), block), PlacedBlock(Vector3(0, 1, 0), block.copy(data=self._IS_UPPER_MASK))