Removed synthetic accessors / Sector sanity tests

This commit is contained in:
Anuken
2020-08-19 15:13:29 -04:00
parent e9f72180e6
commit bbe6c5017a
33 changed files with 87 additions and 73 deletions

View File

@@ -270,7 +270,7 @@ public class Blocks implements ContentList{
}}; }};
grass = new Floor("grass"){{ grass = new Floor("grass"){{
attributes.set(Attribute.water, 0.1f);
}}; }};
salt = new Floor("salt"){{ salt = new Floor("salt"){{

View File

@@ -17,7 +17,7 @@ import static mindustry.content.UnitTypes.*;
import static mindustry.type.ItemStack.*; import static mindustry.type.ItemStack.*;
public class TechTree implements ContentList{ public class TechTree implements ContentList{
private static ObjectMap<UnlockableContent, TechNode> map = new ObjectMap<>(); static ObjectMap<UnlockableContent, TechNode> map = new ObjectMap<>();
public static Seq<TechNode> all; public static Seq<TechNode> all;
public static TechNode root; public static TechNode root;
@@ -544,7 +544,7 @@ public class TechTree implements ContentList{
} }
public static class TechNode{ public static class TechNode{
private static TechNode context; static TechNode context;
/** Depth in tech tree. */ /** Depth in tech tree. */
public int depth; public int depth;

View File

@@ -484,6 +484,9 @@ public class World{
private class Context implements WorldContext{ private class Context implements WorldContext{
Context(){
}
@Override @Override
public Tile tile(int index){ public Tile tile(int index){
return tiles.geti(index); return tiles.geti(index);

View File

@@ -37,18 +37,18 @@ public class MapGenerateDialog extends BaseDialog{
private Pixmap pixmap; private Pixmap pixmap;
private Texture texture; private Texture texture;
private GenerateInput input = new GenerateInput(); private GenerateInput input = new GenerateInput();
private Seq<GenerateFilter> filters = new Seq<>(); Seq<GenerateFilter> filters = new Seq<>();
private int scaling = mobile ? 3 : 1; private int scaling = mobile ? 3 : 1;
private Table filterTable; private Table filterTable;
private AsyncExecutor executor = new AsyncExecutor(1); private AsyncExecutor executor = new AsyncExecutor(1);
private AsyncResult<Void> result; private AsyncResult<Void> result;
private boolean generating; boolean generating;
private GenTile returnTile = new GenTile(); private GenTile returnTile = new GenTile();
private GenTile[][] buffer1, buffer2; private GenTile[][] buffer1, buffer2;
private Cons<Seq<GenerateFilter>> applier; private Cons<Seq<GenerateFilter>> applier;
private CachedTile ctile = new CachedTile(){ CachedTile ctile = new CachedTile(){
//nothing. //nothing.
@Override @Override
protected void changeEntity(Team team, Prov<Building> entityprov, int rotation){ protected void changeEntity(Team team, Prov<Building> entityprov, int rotation){
@@ -408,6 +408,9 @@ public class MapGenerateDialog extends BaseDialog{
public byte team; public byte team;
public short block, floor, ore; public short block, floor, ore;
GenTile(){
}
public void set(Block floor, Block wall, Block ore, Team team){ public void set(Block floor, Block wall, Block ore, Team team){
this.floor = floor.id; this.floor = floor.id;
this.block = wall.id; this.block = wall.id;

View File

@@ -22,7 +22,7 @@ import static mindustry.Vars.ui;
public class MapView extends Element implements GestureListener{ public class MapView extends Element implements GestureListener{
private MapEditor editor; private MapEditor editor;
private EditorTool tool = EditorTool.pencil; EditorTool tool = EditorTool.pencil;
private float offsetx, offsety; private float offsetx, offsety;
private float zoom = 1f; private float zoom = 1f;
private boolean grid = false; private boolean grid = false;
@@ -31,11 +31,11 @@ public class MapView extends Element implements GestureListener{
private Rect rect = new Rect(); private Rect rect = new Rect();
private Vec2[][] brushPolygons = new Vec2[MapEditor.brushSizes.length][0]; private Vec2[][] brushPolygons = new Vec2[MapEditor.brushSizes.length][0];
private boolean drawing; boolean drawing;
private int lastx, lasty; int lastx, lasty;
private int startx, starty; int startx, starty;
private float mousex, mousey; float mousex, mousey;
private EditorTool lastTool; EditorTool lastTool;
public MapView(MapEditor editor){ public MapView(MapEditor editor){
this.editor = editor; this.editor = editor;
@@ -204,7 +204,7 @@ public class MapView extends Element implements GestureListener{
zoom = Mathf.clamp(zoom, 0.2f, 20f); zoom = Mathf.clamp(zoom, 0.2f, 20f);
} }
private Point2 project(float x, float y){ Point2 project(float x, float y){
float ratio = 1f / ((float)editor.width() / editor.height()); float ratio = 1f / ((float)editor.width() / editor.height());
float size = Math.min(width, height); float size = Math.min(width, height);
float sclwidth = size * zoom; float sclwidth = size * zoom;

View File

@@ -23,7 +23,7 @@ import static mindustry.game.SpawnGroup.*;
public class WaveInfoDialog extends BaseDialog{ public class WaveInfoDialog extends BaseDialog{
private int displayed = 20; private int displayed = 20;
private Seq<SpawnGroup> groups = new Seq<>(); Seq<SpawnGroup> groups = new Seq<>();
private Table table; private Table table;
private int start = 0; private int start = 0;

View File

@@ -41,11 +41,10 @@ import static mindustry.Vars.*;
@Component(base = true) @Component(base = true)
abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, QuadTreeObject, Displayable, Senseable, Controllable{ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, QuadTreeObject, Displayable, Senseable, Controllable{
//region vars and initialization //region vars and initialization
static final float timeToSleep = 60f * 1; static final float timeToSleep = 60f * 1, timeToUncontrol = 60f * 6;
static final ObjectSet<Building> tmpTiles = new ObjectSet<>(); static final ObjectSet<Building> tmpTiles = new ObjectSet<>();
static final Seq<Building> tempTileEnts = new Seq<>(); static final Seq<Building> tempTileEnts = new Seq<>();
static final Seq<Tile> tempTiles = new Seq<>(); static final Seq<Tile> tempTiles = new Seq<>();
static final float timeToUncontrol = 60f * 6;
static int sleepingEntities = 0; static int sleepingEntities = 0;
@Import float x, y, health; @Import float x, y, health;

View File

@@ -23,14 +23,14 @@ import java.util.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
public class Saves{ public class Saves{
private Seq<SaveSlot> saves = new Seq<>(); Seq<SaveSlot> saves = new Seq<>();
private @Nullable SaveSlot current; @Nullable SaveSlot current;
private @Nullable SaveSlot lastSectorSave; private @Nullable SaveSlot lastSectorSave;
private AsyncExecutor previewExecutor = new AsyncExecutor(1); AsyncExecutor previewExecutor = new AsyncExecutor(1);
private boolean saving; private boolean saving;
private float time; private float time;
private long totalPlaytime; long totalPlaytime;
private long lastTimestamp; private long lastTimestamp;
public Saves(){ public Saves(){

View File

@@ -23,9 +23,9 @@ public class Tutorial{
private static final int mineCopper = 18; private static final int mineCopper = 18;
private static final int blocksToBreak = 3, blockOffset = -6; private static final int blocksToBreak = 3, blockOffset = -6;
private ObjectSet<String> events = new ObjectSet<>(); ObjectSet<String> events = new ObjectSet<>();
private ObjectIntMap<Block> blocksPlaced = new ObjectIntMap<>(); ObjectIntMap<Block> blocksPlaced = new ObjectIntMap<>();
private int sentence; int sentence;
public TutorialStage stage = TutorialStage.values()[0]; public TutorialStage stage = TutorialStage.values()[0];
public Tutorial(){ public Tutorial(){

View File

@@ -256,5 +256,8 @@ public class FloorRenderer implements Disposable{
/** Maps cache layer ID to cache ID in the batch. /** Maps cache layer ID to cache ID in the batch.
* -1 means that this cache is unoccupied. */ * -1 means that this cache is unoccupied. */
int[] caches = new int[CacheLayer.all.length]; int[] caches = new int[CacheLayer.all.length];
Chunk(){
}
} }
} }

View File

@@ -68,7 +68,7 @@ public class JsonIO{
return json.prettyPrint(in); return json.prettyPrint(in);
} }
private static void apply(Json json){ static void apply(Json json){
json.setIgnoreUnknownFields(true); json.setIgnoreUnknownFields(true);
json.setElementType(Rules.class, "spawns", SpawnGroup.class); json.setElementType(Rules.class, "spawns", SpawnGroup.class);
json.setElementType(Rules.class, "loadout", ItemStack.class); json.setElementType(Rules.class, "loadout", ItemStack.class);

View File

@@ -21,7 +21,7 @@ import mindustry.world.blocks.logic.*;
public class LCanvas extends Table{ public class LCanvas extends Table{
private static final Color backgroundCol = Pal.darkMetal.cpy().mul(0.1f), gridCol = Pal.darkMetal.cpy().mul(0.5f); private static final Color backgroundCol = Pal.darkMetal.cpy().mul(0.1f), gridCol = Pal.darkMetal.cpy().mul(0.5f);
private static Seq<Runnable> postDraw = new Seq<>(); static Seq<Runnable> postDraw = new Seq<>();
private Vec2 offset = new Vec2(); private Vec2 offset = new Vec2();
DragLayout statements; DragLayout statements;

View File

@@ -7,7 +7,7 @@ public enum LCategory{
blocks(Pal.accentBack), blocks(Pal.accentBack),
control(Color.cyan.cpy().shiftSaturation(-0.6f).mul(0.7f)), control(Color.cyan.cpy().shiftSaturation(-0.6f).mul(0.7f)),
operations(Pal.place.cpy().shiftSaturation(-0.5f).mul(0.7f)), operations(Pal.place.cpy().shiftSaturation(-0.5f).mul(0.7f)),
io(Pal.remove.cpy().shiftSaturation(-0.5f).mul(0.7f));; io(Pal.remove.cpy().shiftSaturation(-0.5f).mul(0.7f));
public final Color color; public final Color color;

View File

@@ -32,7 +32,7 @@ public class Maps{
/** List of all built-in maps. Filenames only. */ /** List of all built-in maps. Filenames only. */
private static String[] defaultMapNames = {"maze", "fortress", "labyrinth", "islands", "tendrils", "caldera", "wasteland", "shattered", "fork", "triad", "veins", "glacier"}; private static String[] defaultMapNames = {"maze", "fortress", "labyrinth", "islands", "tendrils", "caldera", "wasteland", "shattered", "fork", "triad", "veins", "glacier"};
/** Maps tagged as PvP */ /** Maps tagged as PvP */
private static final String[] pvpMaps = {"veins", "glacier"}; static final String[] pvpMaps = {"veins", "glacier"};
/** All maps stored in an ordered array. */ /** All maps stored in an ordered array. */
private Seq<Map> maps = new Seq<>(); private Seq<Map> maps = new Seq<>();
/** Serializer for meta. */ /** Serializer for meta. */

View File

@@ -35,9 +35,9 @@ import java.lang.reflect.*;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public class ContentParser{ public class ContentParser{
private static final boolean ignoreUnknownFields = true; private static final boolean ignoreUnknownFields = true;
private ObjectMap<Class<?>, ContentType> contentTypes = new ObjectMap<>(); ObjectMap<Class<?>, ContentType> contentTypes = new ObjectMap<>();
private ObjectMap<Class<?>, FieldParser> classParsers = new ObjectMap<Class<?>, FieldParser>(){{ ObjectMap<Class<?>, FieldParser> classParsers = new ObjectMap<Class<?>, FieldParser>(){{
put(Effect.class, (type, data) -> field(Fx.class, data)); put(Effect.class, (type, data) -> field(Fx.class, data));
put(Schematic.class, (type, data) -> { put(Schematic.class, (type, data) -> {
Object result = fieldOpt(Loadouts.class, data); Object result = fieldOpt(Loadouts.class, data);
@@ -105,7 +105,7 @@ public class ContentParser{
private Seq<Runnable> reads = new Seq<>(); private Seq<Runnable> reads = new Seq<>();
private Seq<Runnable> postreads = new Seq<>(); private Seq<Runnable> postreads = new Seq<>();
private ObjectSet<Object> toBeParsed = new ObjectSet<>(); private ObjectSet<Object> toBeParsed = new ObjectSet<>();
private LoadedMod currentMod; LoadedMod currentMod;
private Content currentContent; private Content currentContent;
private Json parser = new Json(){ private Json parser = new Json(){
@@ -480,7 +480,7 @@ public class ContentParser{
return first != null ? first : Vars.content.getByName(type, currentMod.name + "-" + name); return first != null ? first : Vars.content.getByName(type, currentMod.name + "-" + name);
} }
private <T> T make(Class<T> type){ <T> T make(Class<T> type){
try{ try{
Constructor<T> cons = type.getDeclaredConstructor(); Constructor<T> cons = type.getDeclaredConstructor();
cons.setAccessible(true); cons.setAccessible(true);
@@ -515,7 +515,7 @@ public class ContentParser{
} }
} }
private Object field(Class<?> type, JsonValue value){ Object field(Class<?> type, JsonValue value){
return field(type, value.asString()); return field(type, value.asString());
} }
@@ -530,7 +530,7 @@ public class ContentParser{
} }
} }
private Object fieldOpt(Class<?> type, JsonValue value){ Object fieldOpt(Class<?> type, JsonValue value){
try{ try{
return type.getField(value.asString()).get(null); return type.getField(value.asString()).get(null);
}catch(Exception e){ }catch(Exception e){
@@ -538,7 +538,7 @@ public class ContentParser{
} }
} }
private void checkNullFields(Object object){ void checkNullFields(Object object){
if(object instanceof Number || object instanceof String || toBeParsed.contains(object)) return; if(object instanceof Number || object instanceof String || toBeParsed.contains(object)) return;
parser.getFields(object.getClass()).values().toSeq().each(field -> { parser.getFields(object.getClass()).values().toSeq().each(field -> {
@@ -559,7 +559,7 @@ public class ContentParser{
readFields(object, jsonMap); readFields(object, jsonMap);
} }
private void readFields(Object object, JsonValue jsonMap){ void readFields(Object object, JsonValue jsonMap){
toBeParsed.remove(object); toBeParsed.remove(object);
Class type = object.getClass(); Class type = object.getClass();
ObjectMap<String, FieldMetadata> fields = parser.getFields(type); ObjectMap<String, FieldMetadata> fields = parser.getFields(type);
@@ -593,7 +593,7 @@ public class ContentParser{
} }
/** Tries to resolve a class from a list of potential class names. */ /** Tries to resolve a class from a list of potential class names. */
private <T> Class<T> resolve(String base, String... potentials){ <T> Class<T> resolve(String base, String... potentials){
if(!base.isEmpty() && Character.isLowerCase(base.charAt(0))) base = Strings.capitalize(base); if(!base.isEmpty() && Character.isLowerCase(base.charAt(0))) base = Strings.capitalize(base);
for(String type : potentials){ for(String type : potentials){

View File

@@ -39,7 +39,7 @@ public class Mods implements Loadable{
private int totalSprites; private int totalSprites;
private MultiPacker packer; private MultiPacker packer;
private Seq<LoadedMod> mods = new Seq<>(); Seq<LoadedMod> mods = new Seq<>();
private ObjectMap<Class<?>, ModMeta> metas = new ObjectMap<>(); private ObjectMap<Class<?>, ModMeta> metas = new ObjectMap<>();
private boolean requiresReload, createdAtlas; private boolean requiresReload, createdAtlas;

View File

@@ -23,7 +23,7 @@ public class Scripts implements Disposable{
private final Context context; private final Context context;
private final Scriptable scope; private final Scriptable scope;
private boolean errored; private boolean errored;
private LoadedMod currentMod = null; LoadedMod currentMod = null;
public Scripts(){ public Scripts(){
Time.mark(); Time.mark();

View File

@@ -265,7 +265,7 @@ public class ArcNetProvider implements NetProvider{
return null; return null;
} }
private void handleException(Throwable e){ void handleException(Throwable e){
if(e instanceof ArcNetException){ if(e instanceof ArcNetException){
Core.app.post(() -> net.showError(new IOException("mismatch"))); Core.app.post(() -> net.showError(new IOException("mismatch")));
}else if(e instanceof ClosedChannelException){ }else if(e instanceof ClosedChannelException){

View File

@@ -15,8 +15,8 @@ import mindustry.ui.Links.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
public class AboutDialog extends BaseDialog{ public class AboutDialog extends BaseDialog{
private Seq<String> contributors = new Seq<>(); Seq<String> contributors = new Seq<>();
private static ObjectSet<String> bannedItems = ObjectSet.with("google-play", "itch.io", "dev-builds", "f-droid"); static ObjectSet<String> bannedItems = ObjectSet.with("google-play", "itch.io", "dev-builds", "f-droid");
public AboutDialog(){ public AboutDialog(){
super("@about.button"); super("@about.button");

View File

@@ -8,7 +8,7 @@ import mindustry.graphics.*;
public class ColorPicker extends BaseDialog{ public class ColorPicker extends BaseDialog{
private Cons<Color> cons = c -> {}; private Cons<Color> cons = c -> {};
private Color current = new Color(); Color current = new Color();
public ColorPicker(){ public ColorPicker(){
super("@pickcolor"); super("@pickcolor");

View File

@@ -20,7 +20,7 @@ import static mindustry.Vars.*;
public class CustomRulesDialog extends BaseDialog{ public class CustomRulesDialog extends BaseDialog{
private Table main; private Table main;
private Rules rules; Rules rules;
private Prov<Rules> resetter; private Prov<Rules> resetter;
private LoadoutDialog loadoutDialog; private LoadoutDialog loadoutDialog;
private BaseDialog banDialog; private BaseDialog banDialog;

View File

@@ -17,10 +17,10 @@ import java.util.*;
public class FileChooser extends BaseDialog{ public class FileChooser extends BaseDialog{
private static final Fi homeDirectory = Core.files.absolute(Core.files.getExternalStoragePath()); private static final Fi homeDirectory = Core.files.absolute(Core.files.getExternalStoragePath());
private static Fi lastDirectory = homeDirectory; static Fi lastDirectory = homeDirectory;
private Table files; private Table files;
private Fi directory = lastDirectory; Fi directory = lastDirectory;
private ScrollPane pane; private ScrollPane pane;
private TextField navigation, filefield; private TextField navigation, filefield;
private TextButton ok; private TextButton ok;
@@ -163,7 +163,7 @@ public class FileChooser extends BaseDialog{
return handles; return handles;
} }
private void updateFiles(boolean push){ void updateFiles(boolean push){
if(push) stack.push(directory); if(push) stack.push(directory);
navigation.setText(directory.toString()); navigation.setText(directory.toString());

View File

@@ -30,15 +30,15 @@ import static mindustry.ui.dialogs.PlanetDialog.Mode.*;
public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
private final FrameBuffer buffer = new FrameBuffer(2, 2, true); private final FrameBuffer buffer = new FrameBuffer(2, 2, true);
private final PlanetRenderer planets = renderer.planets; final PlanetRenderer planets = renderer.planets;
private final LaunchLoadoutDialog loadouts = new LaunchLoadoutDialog(); private final LaunchLoadoutDialog loadouts = new LaunchLoadoutDialog();
private final Table stable = new Table().background(Styles.black3); private final Table stable = new Table().background(Styles.black3);
private int launchRange; private int launchRange;
private float zoom = 1f, selectAlpha = 1f; private float zoom = 1f, selectAlpha = 1f;
private @Nullable Sector selected, hovered, launchSector; @Nullable Sector selected, hovered, launchSector;
private CoreBuild launcher; private CoreBuild launcher;
private Mode mode = look; Mode mode = look;
private boolean launching; private boolean launching;
public PlanetDialog(){ public PlanetDialog(){
@@ -291,7 +291,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
} }
//TODO localize //TODO localize
private void updateSelected(){ void updateSelected(){
Sector sector = selected; Sector sector = selected;
if(sector == null){ if(sector == null){

View File

@@ -32,14 +32,14 @@ import java.util.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
public class ResearchDialog extends BaseDialog{ public class ResearchDialog extends BaseDialog{
private final float nodeSize = Scl.scl(60f); final float nodeSize = Scl.scl(60f);
private ObjectSet<TechTreeNode> nodes = new ObjectSet<>(); ObjectSet<TechTreeNode> nodes = new ObjectSet<>();
private TechTreeNode root = new TechTreeNode(TechTree.root, null); TechTreeNode root = new TechTreeNode(TechTree.root, null);
private Rect bounds = new Rect(); Rect bounds = new Rect();
private ItemsDisplay itemDisplay; ItemsDisplay itemDisplay;
private View view; View view;
private ItemSeq items; ItemSeq items;
public ResearchDialog(){ public ResearchDialog(){
super(""); super("");

View File

@@ -74,7 +74,7 @@ public class SchematicsDialog extends BaseDialog{
t.clear(); t.clear();
int i = 0; int i = 0;
String regex = "[`~!@#$%^&*()-_=+[{]}|;:'\",<.>/?]"; String regex = "[`~!@#$%^&*()-_=+{}|;:'\",<.>/?]";
String searchString = search.toLowerCase().replaceAll(regex, " "); String searchString = search.toLowerCase().replaceAll(regex, " ");
firstSchematic = null; firstSchematic = null;

View File

@@ -12,8 +12,8 @@ import mindustry.gen.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
public class BlockConfigFragment extends Fragment{ public class BlockConfigFragment extends Fragment{
private Table table = new Table(); Table table = new Table();
private Building configTile; Building configTile;
@Override @Override
public void build(Group parent){ public void build(Group parent){

View File

@@ -31,12 +31,12 @@ public class BlockInventoryFragment extends Fragment{
private static final float holdWithdraw = 20f; private static final float holdWithdraw = 20f;
private static final float holdShrink = 120f; private static final float holdShrink = 120f;
private Table table = new Table(); Table table = new Table();
private Building tile; Building tile;
private float holdTime = 0f, emptyTime; float holdTime = 0f, emptyTime;
private boolean holding; boolean holding;
private float[] shrinkHoldTimes = new float[content.items().size]; float[] shrinkHoldTimes = new float[content.items().size];
private Item lastItem; Item lastItem;
{ {
Events.on(WorldLoadEvent.class, e -> hide()); Events.on(WorldLoadEvent.class, e -> hide());

View File

@@ -16,7 +16,7 @@ import static mindustry.Vars.*;
public class MinimapFragment extends Fragment{ public class MinimapFragment extends Fragment{
private boolean shown; private boolean shown;
private float panx, pany, zoom = 1f, lastZoom = -1; float panx, pany, zoom = 1f, lastZoom = -1;
private float baseSize = Scl.scl(5f); private float baseSize = Scl.scl(5f);
private Element elem; private Element elem;

View File

@@ -11,7 +11,7 @@ import java.util.*;
public class Tiles implements Iterable<Tile>{ public class Tiles implements Iterable<Tile>{
public final int width, height; public final int width, height;
private final Tile[] array; final Tile[] array;
public Tiles(int width, int height){ public Tiles(int width, int height){
this.array = new Tile[width * height]; this.array = new Tile[width * height];
@@ -87,6 +87,9 @@ public class Tiles implements Iterable<Tile>{
private class TileIterator implements Iterator<Tile>{ private class TileIterator implements Iterator<Tile>{
int index = 0; int index = 0;
TileIterator(){
}
@Override @Override
public boolean hasNext(){ public boolean hasNext(){
return index < array.length; return index < array.length;

View File

@@ -31,8 +31,8 @@ public class ForceProjector extends Block{
public float basePowerDraw = 0.2f; public float basePowerDraw = 0.2f;
public @Load("@-top") TextureRegion topRegion; public @Load("@-top") TextureRegion topRegion;
private static ForceProjectorEntity paramEntity; static ForceProjectorEntity paramEntity;
private static final Cons<Shielderc> shieldConsumer = trait -> { static final Cons<Shielderc> shieldConsumer = trait -> {
if(trait.team() != paramEntity.team && Intersector.isInsideHexagon(paramEntity.x, paramEntity.y, paramEntity.realRadius() * 2f, trait.x(), trait.y())){ if(trait.team() != paramEntity.team && Intersector.isInsideHexagon(paramEntity.x, paramEntity.y, paramEntity.realRadius() * 2f, trait.x(), trait.y())){
trait.absorb(); trait.absorb();
Fx.absorb.at(trait); Fx.absorb.at(trait);

View File

@@ -25,8 +25,8 @@ public class Conveyor extends Block implements Autotiler{
private static final float itemSpace = 0.4f; private static final float itemSpace = 0.4f;
private static final int capacity = 4; private static final int capacity = 4;
private final Vec2 tr1 = new Vec2(); final Vec2 tr1 = new Vec2();
private final Vec2 tr2 = new Vec2(); final Vec2 tr2 = new Vec2();
public @Load(value = "@-#1-#2", lengths = {7, 4}) TextureRegion[][] regions; public @Load(value = "@-#1-#2", lengths = {7, 4}) TextureRegion[][] regions;

View File

@@ -16,7 +16,7 @@ import mindustry.world.meta.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
public class RepairPoint extends Block{ public class RepairPoint extends Block{
private static final Rect rect = new Rect(); static final Rect rect = new Rect();
public int timerTarget = timers++; public int timerTarget = timers++;

View File

@@ -92,6 +92,9 @@ public class SectorTests{
//assertTrue(total < 75, "Sector spawns too many enemies at wave " + i + " (" + total + ")"); //assertTrue(total < 75, "Sector spawns too many enemies at wave " + i + " (" + total + ")");
} }
assertEquals(1, Team.sharded.cores().size, "Sector must have one core: " + zone);
assertTrue(Team.sharded.core().items.total() < 1000, "Sector must not have starting resources: " + zone);
assertTrue(hasSpawnPoint, "Sector \"" + zone.name + "\" has no spawn points."); assertTrue(hasSpawnPoint, "Sector \"" + zone.name + "\" has no spawn points.");
assertTrue(spawner.countSpawns() > 0 || (state.rules.attackMode && state.teams.get(state.rules.waveTeam).hasCore()), "Sector \"" + zone.name + "\" has no enemy spawn points: " + spawner.countSpawns()); assertTrue(spawner.countSpawns() > 0 || (state.rules.attackMode && state.teams.get(state.rules.waveTeam).hasCore()), "Sector \"" + zone.name + "\" has no enemy spawn points: " + spawner.countSpawns());
})); }));