forked from SteamWar/SteamWar
Implement WG45PlotRegion
Implement WS175PlotRegion
This commit is contained in:
+1
-1
@@ -155,7 +155,7 @@ public class DynamicRegionSystem implements RegionSystem {
|
||||
}
|
||||
|
||||
public @NonNull Stream<Region> getRegionsByType(RegionType type) {
|
||||
return regionTypeMap.get(type).stream();
|
||||
return regionTypeMap.getOrDefault(type, Collections.emptySet()).stream();
|
||||
}
|
||||
|
||||
private Stream<Pair<Region, NeighbourDirection>> getNeighbours(Region region, boolean noCorners, boolean fastCache, Collection<Region> regions) {
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public class AreaBlock implements Region.Area {
|
||||
|
||||
int tempSizeZ = switch (copyLocation) {
|
||||
case CENTER -> size.getZ() * 2 + distance;
|
||||
case SIDE -> size.getZ() + distance;
|
||||
case SIDE -> size.getZ() + distance - 1;
|
||||
};
|
||||
|
||||
// Calculate Offset Region to North
|
||||
|
||||
+14
-14
@@ -19,17 +19,16 @@
|
||||
|
||||
package de.steamwar.bausystem.region.dynamic.modes.wargear_45;
|
||||
|
||||
import de.steamwar.bausystem.region.RegionBackups;
|
||||
import de.steamwar.bausystem.region.RegionData;
|
||||
import de.steamwar.bausystem.region.RegionHistory;
|
||||
import de.steamwar.bausystem.region.RegionType;
|
||||
import de.steamwar.bausystem.region.*;
|
||||
import de.steamwar.bausystem.region.dynamic.*;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.AreaBlock;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.AreaTile;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionBackups;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionData;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.miniwargear.MWGUtils;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.warship_230.WS230Utils;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.shared.Pair;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -56,8 +55,8 @@ public class WG45PlotRegion extends DynamicRegion {
|
||||
private static final VariantSelector WIREFRAME = VariantSelector.Get(new File(DIRECTORY, "wireframe"));
|
||||
|
||||
private final AreaTile area;
|
||||
private final Area northArea;
|
||||
private final Area southArea;
|
||||
private final AreaBlock northArea;
|
||||
private final AreaBlock southArea;
|
||||
private final RegionHistory history;
|
||||
private final RegionBackups backups;
|
||||
|
||||
@@ -65,10 +64,11 @@ public class WG45PlotRegion extends DynamicRegion {
|
||||
super(id, minX, minZ);
|
||||
Tile tile = Tile.fromXZ(minX, minZ).orElseThrow();
|
||||
area = new AreaTile(tile, TILE_X, TILE_Z, this, REGION);
|
||||
// northArea = new AreaBlock();
|
||||
// southArea = new AreaBlock();
|
||||
northArea = Area.EMPTY; // TODO: Replace!
|
||||
southArea = Area.EMPTY; // TODO: Replace!
|
||||
|
||||
Pair<AreaBlock, AreaBlock> pair = AreaBlock.create(this, 36, new Point(67, 41, 47), new Point(16, 0, 16), new Point(16, 16, 16), AreaBlock.CopyLocation.CENTER, 50);
|
||||
northArea = pair.getKey();
|
||||
southArea = pair.getValue();
|
||||
|
||||
regionData = new PlotRegionData(this);
|
||||
history = new RegionHistory.Impl(10);
|
||||
backups = new PlotRegionBackups(this, PlotRegionData::new);
|
||||
@@ -89,8 +89,8 @@ public class WG45PlotRegion extends DynamicRegion {
|
||||
public @NonNull Area getBuildArea() {
|
||||
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
||||
case NO_VALUE -> Area.EMPTY;
|
||||
case NORTH -> northArea;//.withSelector(WIREFRAME);
|
||||
case SOUTH -> southArea;//.withSelector(WIREFRAME);
|
||||
case NORTH -> southArea.withSelector(WIREFRAME);
|
||||
case SOUTH -> northArea.withSelector(WIREFRAME);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -98,8 +98,8 @@ public class WG45PlotRegion extends DynamicRegion {
|
||||
public @NonNull Area getTestblockArea() {
|
||||
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
||||
case NO_VALUE -> Area.EMPTY;
|
||||
case NORTH -> southArea;//.withSelector(TESTBLOCK);
|
||||
case SOUTH -> northArea;//.withSelector(TESTBLOCK);
|
||||
case NORTH -> northArea.withSelector(TESTBLOCK);
|
||||
case SOUTH -> southArea.withSelector(TESTBLOCK);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+14
-15
@@ -19,16 +19,14 @@
|
||||
|
||||
package de.steamwar.bausystem.region.dynamic.modes.warship_175;
|
||||
|
||||
import de.steamwar.bausystem.region.RegionBackups;
|
||||
import de.steamwar.bausystem.region.RegionData;
|
||||
import de.steamwar.bausystem.region.RegionHistory;
|
||||
import de.steamwar.bausystem.region.RegionType;
|
||||
import de.steamwar.bausystem.region.*;
|
||||
import de.steamwar.bausystem.region.dynamic.*;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.AreaBlock;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.AreaTile;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionBackups;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionData;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.miniwargear.MWGUtils;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.shared.Pair;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -55,8 +53,8 @@ public class WS175PlotRegion extends DynamicRegion {
|
||||
private static final VariantSelector WIREFRAME = VariantSelector.Get(new File(DIRECTORY, "wireframe"));
|
||||
|
||||
private final AreaTile area;
|
||||
private final Area northArea;
|
||||
private final Area southArea;
|
||||
private final AreaBlock northArea;
|
||||
private final AreaBlock southArea;
|
||||
private final RegionHistory history;
|
||||
private final RegionBackups backups;
|
||||
|
||||
@@ -64,10 +62,11 @@ public class WS175PlotRegion extends DynamicRegion {
|
||||
super(id, minX, minZ);
|
||||
Tile tile = Tile.fromXZ(minX, minZ).orElseThrow();
|
||||
area = new AreaTile(tile, TILE_X, TILE_Z, this, REGION);
|
||||
// northArea = new AreaBlock();
|
||||
// southArea = new AreaBlock();
|
||||
northArea = Area.EMPTY; // TODO: Replace!
|
||||
southArea = Area.EMPTY; // TODO: Replace!
|
||||
|
||||
Pair<AreaBlock, AreaBlock> pair = AreaBlock.create(this, 36, new Point(175, 58, 39), new Point(0, 0, 0), new Point(0, 0, 0), AreaBlock.CopyLocation.SIDE, 132);
|
||||
northArea = pair.getKey();
|
||||
southArea = pair.getValue();
|
||||
|
||||
regionData = new PlotRegionData(this);
|
||||
history = new RegionHistory.Impl(10);
|
||||
backups = new PlotRegionBackups(this, PlotRegionData::new);
|
||||
@@ -88,8 +87,8 @@ public class WS175PlotRegion extends DynamicRegion {
|
||||
public @NonNull Area getBuildArea() {
|
||||
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
||||
case NO_VALUE -> Area.EMPTY;
|
||||
case NORTH -> northArea;//.withSelector(WIREFRAME);
|
||||
case SOUTH -> southArea;//.withSelector(WIREFRAME);
|
||||
case NORTH -> southArea.withSelector(WIREFRAME);
|
||||
case SOUTH -> northArea.withSelector(WIREFRAME);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -97,8 +96,8 @@ public class WS175PlotRegion extends DynamicRegion {
|
||||
public @NonNull Area getTestblockArea() {
|
||||
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
||||
case NO_VALUE -> Area.EMPTY;
|
||||
case NORTH -> southArea;//.withSelector(TESTBLOCK);
|
||||
case SOUTH -> northArea;//.withSelector(TESTBLOCK);
|
||||
case NORTH -> northArea.withSelector(TESTBLOCK);
|
||||
case SOUTH -> southArea.withSelector(TESTBLOCK);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user