forked from SteamWar/SteamWar
Fix SpawnArea and DynamicRegionEditor for Spawn
This commit is contained in:
+9
-4
@@ -368,6 +368,10 @@ public class DynamicRegionEditor implements SWPlayer.Component, Listener {
|
|||||||
checkSpawnRegionAndDelete(Tile.TILE_PN);
|
checkSpawnRegionAndDelete(Tile.TILE_PN);
|
||||||
checkSpawnRegionAndDelete(Tile.TILE_PP);
|
checkSpawnRegionAndDelete(Tile.TILE_PP);
|
||||||
});
|
});
|
||||||
|
DynamicRegionSystem.INSTANCE.get(Tile.TILE_NZ).getArea().place(new PasteBuilder(), false);
|
||||||
|
DynamicRegionSystem.INSTANCE.get(Tile.TILE_PZ).getArea().place(new PasteBuilder(), false);
|
||||||
|
DynamicRegionSystem.INSTANCE.get(Tile.TILE_ZN).getArea().place(new PasteBuilder(), false);
|
||||||
|
DynamicRegionSystem.INSTANCE.get(Tile.TILE_ZP).getArea().place(new PasteBuilder(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkSpawnRegionAndDelete(Tile tile) {
|
private void checkSpawnRegionAndDelete(Tile tile) {
|
||||||
@@ -428,14 +432,15 @@ public class DynamicRegionEditor implements SWPlayer.Component, Listener {
|
|||||||
constructSpawnRegion(Tile.TILE_NN);
|
constructSpawnRegion(Tile.TILE_NN);
|
||||||
constructSpawnRegion(Tile.TILE_NP);
|
constructSpawnRegion(Tile.TILE_NP);
|
||||||
constructSpawnRegion(Tile.TILE_PN);
|
constructSpawnRegion(Tile.TILE_PN);
|
||||||
constructSpawnRegion(Tile.TILE_PP);
|
DynamicRegion region = constructSpawnRegion(Tile.TILE_PP);
|
||||||
|
if (region != null) region.getArea().reset(new PasteBuilder(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void constructSpawnRegion(Tile tile) {
|
private DynamicRegion constructSpawnRegion(Tile tile) {
|
||||||
DynamicRegion region = DynamicRegionRepository.constructRegion(SpawnRegion.class, tile);
|
DynamicRegion region = DynamicRegionRepository.constructRegion(SpawnRegion.class, tile);
|
||||||
if (region == null) return;
|
if (region == null) return null;
|
||||||
region.getArea().place(new PasteBuilder(), false);
|
|
||||||
region.updateNeighbours();
|
region.updateNeighbours();
|
||||||
|
return region;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -44,12 +44,12 @@ public class SpawnArea extends Region.Area {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull Point getMinPoint(boolean extension) {
|
public @NonNull Point getMinPoint(boolean extension) {
|
||||||
return Point.fromLocation(tile.getMinLocation());
|
return Point.fromLocation(tile.getMinLocation()).setY(WORLD_MIN_Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull Point getMaxPoint(boolean extension) {
|
public @NonNull Point getMaxPoint(boolean extension) {
|
||||||
return Point.fromLocation(tile.getMaxLocation());
|
return Point.fromLocation(tile.getMaxLocation()).setY(WORLD_MAX_Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user