Static cleanup
This commit is contained in:
@@ -275,28 +275,6 @@ public class Schematics implements Loadable{
|
|||||||
.removeAll(s -> !s.block.isVisible() || !s.block.unlockedCur());
|
.removeAll(s -> !s.block.isVisible() || !s.block.unlockedCur());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void placeLoadout(Schematic schem, int x, int y){
|
|
||||||
Stile coreTile = schem.tiles.find(s -> s.block instanceof CoreBlock);
|
|
||||||
if(coreTile == null) throw new IllegalArgumentException("Schematic has no core tile. Exiting.");
|
|
||||||
int ox = x - coreTile.x, oy = y - coreTile.y;
|
|
||||||
schem.tiles.each(st -> {
|
|
||||||
Tile tile = world.tile(st.x + ox, st.y + oy);
|
|
||||||
if(tile == null) return;
|
|
||||||
|
|
||||||
tile.setBlock(st.block, state.rules.defaultTeam, 0);
|
|
||||||
tile.rotation(st.rotation);
|
|
||||||
|
|
||||||
Object config = st.config;
|
|
||||||
if(tile.entity != null){
|
|
||||||
tile.entity.configureAny(config);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(st.block instanceof Drill){
|
|
||||||
tile.getLinkedTiles(t -> t.setOverlay(Blocks.oreCopper));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Adds a schematic to the list, also copying it into the files.*/
|
/** Adds a schematic to the list, also copying it into the files.*/
|
||||||
public void add(Schematic schematic){
|
public void add(Schematic schematic){
|
||||||
all.add(schematic);
|
all.add(schematic);
|
||||||
@@ -394,6 +372,28 @@ public class Schematics implements Loadable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void placeLoadout(Schematic schem, int x, int y){
|
||||||
|
Stile coreTile = schem.tiles.find(s -> s.block instanceof CoreBlock);
|
||||||
|
if(coreTile == null) throw new IllegalArgumentException("Schematic has no core tile. Exiting.");
|
||||||
|
int ox = x - coreTile.x, oy = y - coreTile.y;
|
||||||
|
schem.tiles.each(st -> {
|
||||||
|
Tile tile = world.tile(st.x + ox, st.y + oy);
|
||||||
|
if(tile == null) return;
|
||||||
|
|
||||||
|
tile.setBlock(st.block, state.rules.defaultTeam, 0);
|
||||||
|
tile.rotation(st.rotation);
|
||||||
|
|
||||||
|
Object config = st.config;
|
||||||
|
if(tile.entity != null){
|
||||||
|
tile.entity.configureAny(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(st.block instanceof Drill){
|
||||||
|
tile.getLinkedTiles(t -> t.setOverlay(Blocks.oreCopper));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//region IO methods
|
//region IO methods
|
||||||
|
|
||||||
/** Loads a schematic from base64. May throw an exception. */
|
/** Loads a schematic from base64. May throw an exception. */
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import arc.struct.*;
|
|||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.util.noise.*;
|
import arc.util.noise.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
|
import mindustry.game.*;
|
||||||
import mindustry.maps.generators.*;
|
import mindustry.maps.generators.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
|
||||||
@@ -259,7 +260,7 @@ public class TODOPlanetGenerator extends PlanetGenerator{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
schematics.placeLoadout(Loadouts.advancedShard, spawn.x, spawn.y);
|
Schematics.placeLoadout(Loadouts.advancedShard, spawn.x, spawn.y);
|
||||||
|
|
||||||
state.rules.waves = true;
|
state.rules.waves = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user