use of ivorius.reccomplex.world.gen.feature.structure.generic.maze.SavedMazePathConnection in project RecurrentComplex by Ivorforce.
the class TableDataSourceMazePath method cellForIndexInSegment.
@Override
public TableCell cellForIndexInSegment(GuiTable table, int index, int segment) {
if (segment == 1) {
TableCellEnum.Option<EnumFacing>[] optionList = TableDirections.getDirectionOptions(EnumFacing.VALUES);
TableCellEnum<EnumFacing> cell = new TableCellEnum<>("side", directionFromPath(mazePath), optionList);
cell.addPropertyConsumer(val -> {
SavedMazePathConnection path = pathFromDirection(val, mazePath.sourceRoom.getCoordinates());
mazePath.pathDimension = path.path.pathDimension;
mazePath.pathGoesUp = path.path.pathGoesUp;
tableDelegate.reloadData();
});
return new TitledCell(IvTranslations.get("reccomplex.generationInfo.mazeComponent.path.side"), cell);
} else if (segment == 2) {
invertableButton = new TableCellButton("actions", "inverse", IvTranslations.get("reccomplex.generationInfo.mazeComponent.path.invert"), isInvertable());
invertableButton.addAction(() -> {
mazePath.set(mazePath.inverse());
source.room = mazePath.sourceRoom;
tableDelegate.reloadData();
});
return new TitledCell(invertableButton);
}
return super.cellForIndexInSegment(table, index, segment);
}
use of ivorius.reccomplex.world.gen.feature.structure.generic.maze.SavedMazePathConnection in project RecurrentComplex by Ivorforce.
the class TableDataSourceMazePath method pathFromDirection.
public static SavedMazePathConnection pathFromDirection(EnumFacing side, int[] room) {
int pathDim = side.getFrontOffsetX() != 0 ? 0 : side.getFrontOffsetY() != 0 ? 1 : side.getFrontOffsetZ() != 0 ? 2 : -1;
int offset = side.getFrontOffsetX() + side.getFrontOffsetY() + side.getFrontOffsetZ();
return new SavedMazePathConnection(pathDim, new MazeRoom(room[0], room[1], room[2]), offset > 0, ConnectorStrategy.DEFAULT_PATH, Collections.emptyList());
}
Aggregations