mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-04 16:09:23 +07:00
Static cleanup
This commit is contained in:
parent
fce89d4db5
commit
d6412bf19c
@ -275,28 +275,6 @@ public class Schematics implements Loadable{
|
||||
.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.*/
|
||||
public void add(Schematic 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
|
||||
|
||||
/** Loads a schematic from base64. May throw an exception. */
|
||||
|
@ -7,6 +7,7 @@ import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import arc.util.noise.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.maps.generators.*;
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user