mirror of
https://github.com/Anuken/Mindustry.git
synced 2024-09-17 11:27:35 +03:00
Seq.
This commit is contained in:
parent
87ab895253
commit
8ea28e1ced
Binary file not shown.
Before Width: | Height: | Size: 176 B |
Binary file not shown.
Before Width: | Height: | Size: 170 B |
Binary file not shown.
Before Width: | Height: | Size: 333 B |
Binary file not shown.
Before Width: | Height: | Size: 270 B |
Binary file not shown.
Before Width: | Height: | Size: 528 B |
@ -62,7 +62,7 @@ public class Vars implements Loadable{
|
||||
/** URL of the github issue report template.*/
|
||||
public static final String reportIssueURL = "https://github.com/Anuken/Mindustry/issues/new?template=bug_report.md";
|
||||
/** list of built-in servers.*/
|
||||
public static final Array<String> defaultServers = Array.with();
|
||||
public static final Seq<String> defaultServers = Seq.with();
|
||||
/** maximum distance between mine and core that supports automatic transferring */
|
||||
public static final float mineTransferRange = 220f;
|
||||
/** max chat message length */
|
||||
@ -272,7 +272,7 @@ public class Vars implements Loadable{
|
||||
String[] tags = {"[green][D][]", "[royal][I][]", "[yellow][W][]", "[scarlet][E][]", ""};
|
||||
String[] stags = {"&lc&fb[D]", "&lg&fb[I]", "&ly&fb[W]", "&lr&fb[E]", ""};
|
||||
|
||||
Array<String> logBuffer = new Array<>();
|
||||
Seq<String> logBuffer = new Seq<>();
|
||||
Log.setLogger((level, text) -> {
|
||||
String result = text;
|
||||
String rawText = Log.format(stags[level.ordinal()] + "&fr " + text);
|
||||
|
@ -11,20 +11,20 @@ import static mindustry.Vars.world;
|
||||
public class Astar{
|
||||
public static final DistanceHeuristic manhattan = (x1, y1, x2, y2) -> Math.abs(x1 - x2) + Math.abs(y1 - y2);
|
||||
|
||||
private static final Array<Tile> out = new Array<>();
|
||||
private static final Seq<Tile> out = new Seq<>();
|
||||
private static final PQueue<Tile> queue = new PQueue<>(200 * 200 / 4, (a, b) -> 0);
|
||||
private static final IntFloatMap costs = new IntFloatMap();
|
||||
private static byte[][] rotations;
|
||||
|
||||
public static Array<Tile> pathfind(Tile from, Tile to, TileHueristic th, Boolf<Tile> passable){
|
||||
public static Seq<Tile> pathfind(Tile from, Tile to, TileHueristic th, Boolf<Tile> passable){
|
||||
return pathfind(from.x, from.y, to.x, to.y, th, manhattan, passable);
|
||||
}
|
||||
|
||||
public static Array<Tile> pathfind(int startX, int startY, int endX, int endY, TileHueristic th, Boolf<Tile> passable){
|
||||
public static Seq<Tile> pathfind(int startX, int startY, int endX, int endY, TileHueristic th, Boolf<Tile> passable){
|
||||
return pathfind(startX, startY, endX, endY, th, manhattan, passable);
|
||||
}
|
||||
|
||||
public static Array<Tile> pathfind(int startX, int startY, int endX, int endY, TileHueristic th, DistanceHeuristic dh, Boolf<Tile> passable){
|
||||
public static Seq<Tile> pathfind(int startX, int startY, int endX, int endY, TileHueristic th, DistanceHeuristic dh, Boolf<Tile> passable){
|
||||
Tiles tiles = world.tiles;
|
||||
|
||||
Tile start = tiles.getn(startX, startY);
|
||||
|
@ -54,7 +54,7 @@ public class BaseAI{
|
||||
int wx = (int)(core.tileX() + Tmp.v1.x), wy = (int)(core.tileY() + Tmp.v1.y);
|
||||
Tile tile = world.tiles.getc(wx, wy);
|
||||
|
||||
Array<BasePart> parts = null;
|
||||
Seq<BasePart> parts = null;
|
||||
|
||||
//pick a completely random base part, and place it a random location
|
||||
//((yes, very intelligent))
|
||||
|
@ -19,12 +19,12 @@ import java.io.*;
|
||||
import static mindustry.Vars.tilesize;
|
||||
|
||||
public class BaseRegistry{
|
||||
public Array<BasePart> cores = new Array<>();
|
||||
public Array<BasePart> parts = new Array<>();
|
||||
public ObjectMap<Content, Array<BasePart>> reqParts = new ObjectMap<>();
|
||||
public Seq<BasePart> cores = new Seq<>();
|
||||
public Seq<BasePart> parts = new Seq<>();
|
||||
public ObjectMap<Content, Seq<BasePart>> reqParts = new ObjectMap<>();
|
||||
|
||||
public Array<BasePart> forResource(Content item){
|
||||
return reqParts.get(item, Array::new);
|
||||
public Seq<BasePart> forResource(Content item){
|
||||
return reqParts.get(item, Seq::new);
|
||||
}
|
||||
|
||||
public void load(){
|
||||
@ -85,7 +85,7 @@ public class BaseRegistry{
|
||||
part.centerY = part.schematic.height/2;
|
||||
}
|
||||
|
||||
if(part.required != null) reqParts.get(part.required, Array::new).add(part);
|
||||
if(part.required != null) reqParts.get(part.required, Seq::new).add(part);
|
||||
|
||||
}catch(IOException e){
|
||||
throw new RuntimeException(e);
|
||||
|
@ -38,7 +38,7 @@ public class BlockIndexer{
|
||||
/** All ores available on this map. */
|
||||
private ObjectSet<Item> allOres = new ObjectSet<>();
|
||||
/** Stores teams that are present here as tiles. */
|
||||
private Array<Team> activeTeams = new Array<>();
|
||||
private Seq<Team> activeTeams = new Seq<>();
|
||||
/** Maps teams to a map of flagged tiles by flag. */
|
||||
private TileArray[][] flagMap = new TileArray[Team.all.length][BlockFlag.all.length];
|
||||
/** Max units by team. */
|
||||
@ -48,7 +48,7 @@ public class BlockIndexer{
|
||||
/** Empty set used for returning. */
|
||||
private TileArray emptySet = new TileArray();
|
||||
/** Array used for returning and reusing. */
|
||||
private Array<Tile> returnArray = new Array<>();
|
||||
private Seq<Tile> returnArray = new Seq<>();
|
||||
|
||||
public BlockIndexer(){
|
||||
Events.on(TileChangeEvent.class, event -> {
|
||||
@ -196,7 +196,7 @@ public class BlockIndexer{
|
||||
}
|
||||
|
||||
/** Get all enemy blocks with a flag. */
|
||||
public Array<Tile> getEnemy(Team team, BlockFlag type){
|
||||
public Seq<Tile> getEnemy(Team team, BlockFlag type){
|
||||
returnArray.clear();
|
||||
for(Team enemy : team.enemies()){
|
||||
if(state.teams.isActive(enemy)){
|
||||
@ -446,7 +446,7 @@ public class BlockIndexer{
|
||||
}
|
||||
|
||||
public static class TileArray implements Iterable<Tile>{
|
||||
private Array<Tile> tiles = new Array<>(false, 16);
|
||||
private Seq<Tile> tiles = new Seq<>(false, 16);
|
||||
private IntSet contained = new IntSet();
|
||||
|
||||
public void add(Tile tile){
|
||||
|
@ -26,7 +26,7 @@ public class Pathfinder implements Runnable{
|
||||
/** tile data, see PathTileStruct */
|
||||
private int[][] tiles;
|
||||
/** unordered array of path data for iteration only. DO NOT iterate or access this in the main thread. */
|
||||
private Array<Flowfield> threadList = new Array<>(), mainList = new Array<>();
|
||||
private Seq<Flowfield> threadList = new Seq<>(), mainList = new Seq<>();
|
||||
/** Maps team ID and target to to a flowfield.*/
|
||||
private ObjectMap<PathTarget, Flowfield>[] fieldMap = new ObjectMap[Team.all.length];
|
||||
/** Used field maps. */
|
||||
@ -37,7 +37,7 @@ public class Pathfinder implements Runnable{
|
||||
private ObjectMap<Position, PathTarget> targetCache = new ObjectMap<>();
|
||||
/** Current pathfinding thread */
|
||||
private @Nullable Thread thread;
|
||||
private IntArray tmpArray = new IntArray();
|
||||
private IntSeq tmpArray = new IntSeq();
|
||||
|
||||
public Pathfinder(){
|
||||
Events.on(WorldLoadEvent.class, event -> {
|
||||
@ -48,8 +48,8 @@ public class Pathfinder implements Runnable{
|
||||
fieldMap = new ObjectMap[Team.all.length];
|
||||
fieldMapUsed = new ObjectSet[Team.all.length];
|
||||
targetCache = new ObjectMap<>();
|
||||
threadList = new Array<>();
|
||||
mainList = new Array<>();
|
||||
threadList = new Seq<>();
|
||||
mainList = new Seq<>();
|
||||
|
||||
for(Tile tile : world.tiles){
|
||||
tiles[tile.x][tile.y] = packTile(tile);
|
||||
@ -189,7 +189,7 @@ public class Pathfinder implements Runnable{
|
||||
//if this combination is not found, create it on request
|
||||
if(fieldMapUsed[team.uid].add(target)){
|
||||
//grab targets since this is run on main thread
|
||||
IntArray targets = target.getPositions(team, new IntArray());
|
||||
IntSeq targets = target.getPositions(team, new IntSeq());
|
||||
queue.post(() -> createPath(team, target, targets));
|
||||
}
|
||||
return tile;
|
||||
@ -293,14 +293,14 @@ public class Pathfinder implements Runnable{
|
||||
}
|
||||
|
||||
private void preloadPath(Team team, PathTarget target){
|
||||
updateFrontier(createPath(team, target, target.getPositions(team, new IntArray())), -1);
|
||||
updateFrontier(createPath(team, target, target.getPositions(team, new IntSeq())), -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Created a new flowfield that aims to get to a certain target for a certain team.
|
||||
* Pathfinding thread only.
|
||||
*/
|
||||
private Flowfield createPath(Team team, PathTarget target, IntArray targets){
|
||||
private Flowfield createPath(Team team, PathTarget target, IntSeq targets){
|
||||
Flowfield path = new Flowfield(team, target, world.width(), world.height());
|
||||
path.lastUpdateTime = Time.millis();
|
||||
|
||||
@ -391,14 +391,14 @@ public class Pathfinder implements Runnable{
|
||||
|
||||
public static final FlagTarget[] all = values();
|
||||
|
||||
private final Cons2<Team, IntArray> targeter;
|
||||
private final Cons2<Team, IntSeq> targeter;
|
||||
|
||||
FlagTarget(Cons2<Team, IntArray> targeter){
|
||||
FlagTarget(Cons2<Team, IntSeq> targeter){
|
||||
this.targeter = targeter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntArray getPositions(Team team, IntArray out){
|
||||
public IntSeq getPositions(Team team, IntSeq out){
|
||||
targeter.get(team, out);
|
||||
return out;
|
||||
}
|
||||
@ -417,7 +417,7 @@ public class Pathfinder implements Runnable{
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntArray getPositions(Team team, IntArray out){
|
||||
public IntSeq getPositions(Team team, IntSeq out){
|
||||
out.add(Point2.pack(world.toTile(position.getX()), world.toTile(position.getY())));
|
||||
return out;
|
||||
}
|
||||
@ -430,7 +430,7 @@ public class Pathfinder implements Runnable{
|
||||
|
||||
public interface PathTarget{
|
||||
/** Gets targets to pathfind towards. This must run on the main thread. */
|
||||
IntArray getPositions(Team team, IntArray out);
|
||||
IntSeq getPositions(Team team, IntSeq out);
|
||||
/** Refresh rate in milliseconds. Return any number <= 0 to disable. */
|
||||
int refreshRate();
|
||||
}
|
||||
@ -448,7 +448,7 @@ public class Pathfinder implements Runnable{
|
||||
/** search frontier, these are Pos objects */
|
||||
final IntQueue frontier = new IntQueue();
|
||||
/** all target positions; these positions have a cost of 0, and must be synchronized on! */
|
||||
final IntArray targets = new IntArray();
|
||||
final IntSeq targets = new IntSeq();
|
||||
/** current search ID */
|
||||
int search = 1;
|
||||
/** last updated time */
|
||||
|
@ -17,7 +17,7 @@ import static mindustry.Vars.*;
|
||||
public class WaveSpawner{
|
||||
private static final float margin = 40f, coreMargin = tilesize * 3; //how far away from the edge flying units spawn
|
||||
|
||||
private Array<Tile> spawns = new Array<>();
|
||||
private Seq<Tile> spawns = new Seq<>();
|
||||
private boolean spawning = false;
|
||||
|
||||
public WaveSpawner(){
|
||||
@ -28,7 +28,7 @@ public class WaveSpawner{
|
||||
return spawns.size;
|
||||
}
|
||||
|
||||
public Array<Tile> getSpawns(){
|
||||
public Seq<Tile> getSpawns(){
|
||||
return spawns;
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ import arc.struct.*;
|
||||
* {@code BoundedSlotAssignmentStrategy} is an abstract implementation of {@link SlotAssignmentStrategy} that supports roles.
|
||||
* Generally speaking, there are hard and soft roles. Hard roles cannot be broken, soft roles can.
|
||||
* <p>
|
||||
* This abstract class provides an implementation of the {@link #calculateNumberOfSlots(Array) calculateNumberOfSlots} method that
|
||||
* This abstract class provides an implementation of the {@link #calculateNumberOfSlots(Seq) calculateNumberOfSlots} method that
|
||||
* is more general (and costly) than the simplified implementation in {@link FreeSlotAssignmentStrategy}. It scans the assignment
|
||||
* list to find the number of filled slots, which is the highest slot number in the assignments.
|
||||
* @author davebaol
|
||||
@ -15,10 +15,10 @@ import arc.struct.*;
|
||||
public abstract class BoundedSlotAssignmentStrategy implements SlotAssignmentStrategy{
|
||||
|
||||
@Override
|
||||
public abstract void updateSlotAssignments(Array<SlotAssignment> assignments);
|
||||
public abstract void updateSlotAssignments(Seq<SlotAssignment> assignments);
|
||||
|
||||
@Override
|
||||
public int calculateNumberOfSlots(Array<SlotAssignment> assignments){
|
||||
public int calculateNumberOfSlots(Seq<SlotAssignment> assignments){
|
||||
// Find the number of filled slots: it will be the
|
||||
// highest slot number in the assignments
|
||||
int filledSlots = -1;
|
||||
@ -32,7 +32,7 @@ public abstract class BoundedSlotAssignmentStrategy implements SlotAssignmentStr
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSlotAssignment(Array<SlotAssignment> assignments, int index){
|
||||
public void removeSlotAssignment(Seq<SlotAssignment> assignments, int index){
|
||||
int sn = assignments.get(index).slotNumber;
|
||||
for(int i = 0; i < assignments.size; i++){
|
||||
SlotAssignment sa = assignments.get(i);
|
||||
|
@ -13,8 +13,8 @@ public class DistanceAssignmentStrategy implements SlotAssignmentStrategy{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSlotAssignments(Array<SlotAssignment> assignments){
|
||||
IntArray slots = IntArray.range(0, assignments.size);
|
||||
public void updateSlotAssignments(Seq<SlotAssignment> assignments){
|
||||
IntSeq slots = IntSeq.range(0, assignments.size);
|
||||
|
||||
for(SlotAssignment slot : assignments){
|
||||
int mindex = 0;
|
||||
@ -35,12 +35,12 @@ public class DistanceAssignmentStrategy implements SlotAssignmentStrategy{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculateNumberOfSlots(Array<SlotAssignment> assignments){
|
||||
public int calculateNumberOfSlots(Seq<SlotAssignment> assignments){
|
||||
return assignments.size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSlotAssignment(Array<SlotAssignment> assignments, int index){
|
||||
public void removeSlotAssignment(Seq<SlotAssignment> assignments, int index){
|
||||
assignments.remove(index);
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ import arc.struct.*;
|
||||
public class Formation{
|
||||
|
||||
/** A list of slots assignments. */
|
||||
public Array<SlotAssignment> slotAssignments;
|
||||
public Seq<SlotAssignment> slotAssignments;
|
||||
|
||||
/** The anchor point of this formation. */
|
||||
public Vec3 anchor;
|
||||
@ -74,7 +74,7 @@ public class Formation{
|
||||
this.slotAssignmentStrategy = slotAssignmentStrategy;
|
||||
this.motionModerator = motionModerator;
|
||||
|
||||
this.slotAssignments = new Array<>();
|
||||
this.slotAssignments = new Seq<>();
|
||||
this.driftOffset = new Vec3();
|
||||
this.positionOffset = new Vec2(anchor.x, anchor.y).cpy();
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public abstract class FormationMotionModerator{
|
||||
* @param pattern the pattern
|
||||
* @return the given location for chaining.
|
||||
*/
|
||||
public Vec3 calculateDriftOffset(Vec3 centerOfMass, Array<SlotAssignment> slotAssignments, FormationPattern pattern){
|
||||
public Vec3 calculateDriftOffset(Vec3 centerOfMass, Seq<SlotAssignment> slotAssignments, FormationPattern pattern){
|
||||
// Clear the center of mass
|
||||
centerOfMass.x = centerOfMass.y = 0;
|
||||
float centerOfMassOrientation = 0;
|
||||
|
@ -13,7 +13,7 @@ import arc.struct.*;
|
||||
public class FreeSlotAssignmentStrategy implements SlotAssignmentStrategy{
|
||||
|
||||
@Override
|
||||
public void updateSlotAssignments(Array<SlotAssignment> assignments){
|
||||
public void updateSlotAssignments(Seq<SlotAssignment> assignments){
|
||||
// A very simple assignment algorithm: we simply go through
|
||||
// each assignment in the list and assign sequential slot numbers
|
||||
for(int i = 0; i < assignments.size; i++)
|
||||
@ -21,12 +21,12 @@ public class FreeSlotAssignmentStrategy implements SlotAssignmentStrategy{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculateNumberOfSlots(Array<SlotAssignment> assignments){
|
||||
public int calculateNumberOfSlots(Seq<SlotAssignment> assignments){
|
||||
return assignments.size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSlotAssignment(Array<SlotAssignment> assignments, int index){
|
||||
public void removeSlotAssignment(Seq<SlotAssignment> assignments, int index){
|
||||
assignments.remove(index);
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,12 @@ import arc.struct.*;
|
||||
public interface SlotAssignmentStrategy{
|
||||
|
||||
/** Updates the assignment of members to slots */
|
||||
void updateSlotAssignments(Array<SlotAssignment> assignments);
|
||||
void updateSlotAssignments(Seq<SlotAssignment> assignments);
|
||||
|
||||
/** Calculates the number of slots from the assignment data. */
|
||||
int calculateNumberOfSlots(Array<SlotAssignment> assignments);
|
||||
int calculateNumberOfSlots(Seq<SlotAssignment> assignments);
|
||||
|
||||
/** Removes the slot assignment at the specified index. */
|
||||
void removeSlotAssignment(Array<SlotAssignment> assignments, int index);
|
||||
void removeSlotAssignment(Seq<SlotAssignment> assignments, int index);
|
||||
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import arc.util.*;
|
||||
public class SoftRoleSlotAssignmentStrategy extends BoundedSlotAssignmentStrategy{
|
||||
protected SlotCostProvider slotCostProvider;
|
||||
protected float costThreshold;
|
||||
private BooleanArray filledSlots;
|
||||
private BoolSeq filledSlots;
|
||||
|
||||
/**
|
||||
* Creates a {@code SoftRoleSlotAssignmentStrategy} with the given slot cost provider and no cost threshold.
|
||||
@ -46,14 +46,14 @@ public class SoftRoleSlotAssignmentStrategy extends BoundedSlotAssignmentStrateg
|
||||
this.slotCostProvider = slotCostProvider;
|
||||
this.costThreshold = costThreshold;
|
||||
|
||||
this.filledSlots = new BooleanArray();
|
||||
this.filledSlots = new BoolSeq();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSlotAssignments(Array<SlotAssignment> assignments){
|
||||
public void updateSlotAssignments(Seq<SlotAssignment> assignments){
|
||||
|
||||
// Holds a list of member and slot data for each member.
|
||||
Array<MemberAndSlots> memberData = new Array<>();
|
||||
Seq<MemberAndSlots> memberData = new Seq<>();
|
||||
|
||||
// Compile the member data
|
||||
int numberOfAssignments = assignments.size;
|
||||
@ -146,12 +146,12 @@ public class SoftRoleSlotAssignmentStrategy extends BoundedSlotAssignmentStrateg
|
||||
static class MemberAndSlots implements Comparable<MemberAndSlots>{
|
||||
FormationMember member;
|
||||
float assignmentEase;
|
||||
Array<CostAndSlot> costAndSlots;
|
||||
Seq<CostAndSlot> costAndSlots;
|
||||
|
||||
public MemberAndSlots(FormationMember member){
|
||||
this.member = member;
|
||||
this.assignmentEase = 0f;
|
||||
this.costAndSlots = new Array<>();
|
||||
this.costAndSlots = new Seq<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,13 +11,13 @@ import static mindustry.Vars.state;
|
||||
|
||||
public class AsyncCore{
|
||||
//all processes to be executed each frame
|
||||
private final Array<AsyncProcess> processes = Array.with(
|
||||
private final Seq<AsyncProcess> processes = Seq.with(
|
||||
new PhysicsProcess(),
|
||||
Vars.teamIndex = new TeamIndexProcess()
|
||||
);
|
||||
|
||||
//futures to be awaited
|
||||
private final Array<Future<?>> futures = new Array<>();
|
||||
private final Seq<Future<?>> futures = new Seq<>();
|
||||
|
||||
private final ExecutorService executor = Executors.newFixedThreadPool(processes.size, r -> {
|
||||
Thread thread = new Thread(r, "AsyncLogic-Thread");
|
||||
|
@ -10,7 +10,7 @@ import mindustry.gen.*;
|
||||
|
||||
public class PhysicsProcess implements AsyncProcess{
|
||||
private Physics physics;
|
||||
private Array<PhysicRef> refs = new Array<>(false);
|
||||
private Seq<PhysicRef> refs = new Seq<>(false);
|
||||
private BodyDef def;
|
||||
|
||||
private EntityGroup<? extends Physicsc> group;
|
||||
|
@ -16,9 +16,9 @@ public class MusicControl{
|
||||
protected static final float finTime = 120f, foutTime = 120f, musicInterval = 60 * 60 * 3f, musicChance = 0.6f, musicWaveChance = 0.5f;
|
||||
|
||||
/** normal, ambient music, plays at any time */
|
||||
public Array<Music> ambientMusic = Array.with();
|
||||
public Seq<Music> ambientMusic = Seq.with();
|
||||
/** darker music, used in times of conflict */
|
||||
public Array<Music> darkMusic = Array.with();
|
||||
public Seq<Music> darkMusic = Seq.with();
|
||||
protected Music lastRandomPlayed;
|
||||
protected Interval timer = new Interval();
|
||||
protected @Nullable Music current;
|
||||
@ -39,8 +39,8 @@ public class MusicControl{
|
||||
protected void reload(){
|
||||
current = null;
|
||||
fade = 0f;
|
||||
ambientMusic = Array.with(Musics.game1, Musics.game3, Musics.game4, Musics.game6);
|
||||
darkMusic = Array.with(Musics.game2, Musics.game5, Musics.game7);
|
||||
ambientMusic = Seq.with(Musics.game1, Musics.game3, Musics.game4, Musics.game6);
|
||||
darkMusic = Seq.with(Musics.game2, Musics.game5, Musics.game7);
|
||||
}
|
||||
|
||||
public void stop(){
|
||||
|
@ -120,8 +120,8 @@ public class Fx{
|
||||
}),
|
||||
|
||||
lightning = new Effect(10f, 500f, e -> {
|
||||
if(!(e.data instanceof Array)) return;
|
||||
Array<Vec2> lines = e.data();
|
||||
if(!(e.data instanceof Seq)) return;
|
||||
Seq<Vec2> lines = e.data();
|
||||
|
||||
stroke(3f * e.fout());
|
||||
color(e.color, Color.white, e.fin());
|
||||
|
@ -4,7 +4,7 @@ import mindustry.ctype.*;
|
||||
import mindustry.game.Objectives.*;
|
||||
import mindustry.type.*;
|
||||
|
||||
import static arc.struct.Array.with;
|
||||
import static arc.struct.Seq.with;
|
||||
import static mindustry.content.Items.*;
|
||||
import static mindustry.content.Planets.starter;
|
||||
import static mindustry.type.ItemStack.list;
|
||||
|
@ -11,13 +11,13 @@ import mindustry.world.*;
|
||||
import static mindustry.content.Blocks.*;
|
||||
|
||||
public class TechTree implements ContentList{
|
||||
public static Array<TechNode> all;
|
||||
public static Seq<TechNode> all;
|
||||
public static TechNode root;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
TechNode.context = null;
|
||||
all = new Array<>();
|
||||
all = new Seq<>();
|
||||
|
||||
root = node(coreShard, () -> {
|
||||
|
||||
@ -328,7 +328,7 @@ public class TechTree implements ContentList{
|
||||
/** Research turns required to research this content. */
|
||||
public int turns = 3; //TODO keep track of turns that have been used so far
|
||||
/** Nodes that depend on this node. */
|
||||
public final Array<TechNode> children = new Array<>();
|
||||
public final Seq<TechNode> children = new Seq<>();
|
||||
|
||||
TechNode(TechNode ccontext, UnlockableContent content, ItemStack[] requirements, Runnable children){
|
||||
if(ccontext != null){
|
||||
|
@ -23,7 +23,7 @@ import static mindustry.Vars.mods;
|
||||
@SuppressWarnings("unchecked")
|
||||
public class ContentLoader{
|
||||
private ObjectMap<String, MappableContent>[] contentNameMap = new ObjectMap[ContentType.values().length];
|
||||
private Array<Content>[] contentMap = new Array[ContentType.values().length];
|
||||
private Seq<Content>[] contentMap = new Seq[ContentType.values().length];
|
||||
private MappableContent[][] temporaryMapper;
|
||||
private @Nullable LoadedMod currentMod;
|
||||
private @Nullable Content lastAdded;
|
||||
@ -49,11 +49,11 @@ public class ContentLoader{
|
||||
/** Clears all initialized content.*/
|
||||
public void clear(){
|
||||
contentNameMap = new ObjectMap[ContentType.values().length];
|
||||
contentMap = new Array[ContentType.values().length];
|
||||
contentMap = new Seq[ContentType.values().length];
|
||||
initialization = new ObjectSet<>();
|
||||
|
||||
for(ContentType type : ContentType.values()){
|
||||
contentMap[type.ordinal()] = new Array<>();
|
||||
contentMap[type.ordinal()] = new Seq<>();
|
||||
contentNameMap[type.ordinal()] = new ObjectMap<>();
|
||||
}
|
||||
}
|
||||
@ -76,7 +76,7 @@ public class ContentLoader{
|
||||
/** Logs content statistics.*/
|
||||
public void logContent(){
|
||||
//check up ID mapping, make sure it's linear (debug only)
|
||||
for(Array<Content> arr : contentMap){
|
||||
for(Seq<Content> arr : contentMap){
|
||||
for(int i = 0; i < arr.size; i++){
|
||||
int id = arr.get(i).id;
|
||||
if(id != i){
|
||||
@ -89,7 +89,7 @@ public class ContentLoader{
|
||||
for(int k = 0; k < contentMap.length; k++){
|
||||
Log.debug("[@]: loaded @", ContentType.values()[k].name(), contentMap[k].size);
|
||||
}
|
||||
Log.debug("Total content loaded: @", Array.with(ContentType.values()).mapInt(c -> contentMap[c.ordinal()].size).sum());
|
||||
Log.debug("Total content loaded: @", Seq.with(ContentType.values()).mapInt(c -> contentMap[c.ordinal()].size).sum());
|
||||
Log.debug("-------------------");
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ public class ContentLoader{
|
||||
this.temporaryMapper = temporaryMapper;
|
||||
}
|
||||
|
||||
public Array<Content>[] getContentMap(){
|
||||
public Seq<Content>[] getContentMap(){
|
||||
return contentMap;
|
||||
}
|
||||
|
||||
@ -226,13 +226,13 @@ public class ContentLoader{
|
||||
return (T)contentMap[type.ordinal()].get(id);
|
||||
}
|
||||
|
||||
public <T extends Content> Array<T> getBy(ContentType type){
|
||||
return (Array<T>)contentMap[type.ordinal()];
|
||||
public <T extends Content> Seq<T> getBy(ContentType type){
|
||||
return (Seq<T>)contentMap[type.ordinal()];
|
||||
}
|
||||
|
||||
//utility methods, just makes things a bit shorter
|
||||
|
||||
public Array<Block> blocks(){
|
||||
public Seq<Block> blocks(){
|
||||
return getBy(ContentType.block);
|
||||
}
|
||||
|
||||
@ -244,7 +244,7 @@ public class ContentLoader{
|
||||
return (Block)getByName(ContentType.block, name);
|
||||
}
|
||||
|
||||
public Array<Item> items(){
|
||||
public Seq<Item> items(){
|
||||
return getBy(ContentType.item);
|
||||
}
|
||||
|
||||
@ -252,7 +252,7 @@ public class ContentLoader{
|
||||
return (Item)getByID(ContentType.item, id);
|
||||
}
|
||||
|
||||
public Array<Liquid> liquids(){
|
||||
public Seq<Liquid> liquids(){
|
||||
return getBy(ContentType.liquid);
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ public class ContentLoader{
|
||||
return (Liquid)getByID(ContentType.liquid, id);
|
||||
}
|
||||
|
||||
public Array<BulletType> bullets(){
|
||||
public Seq<BulletType> bullets(){
|
||||
return getBy(ContentType.bullet);
|
||||
}
|
||||
|
||||
@ -268,15 +268,15 @@ public class ContentLoader{
|
||||
return (BulletType)getByID(ContentType.bullet, id);
|
||||
}
|
||||
|
||||
public Array<SectorPreset> sectors(){
|
||||
public Seq<SectorPreset> sectors(){
|
||||
return getBy(ContentType.sector);
|
||||
}
|
||||
|
||||
public Array<UnitType> units(){
|
||||
public Seq<UnitType> units(){
|
||||
return getBy(ContentType.unit);
|
||||
}
|
||||
|
||||
public Array<Planet> planets(){
|
||||
public Seq<Planet> planets(){
|
||||
return getBy(ContentType.planet);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class Control implements ApplicationListener, Loadable{
|
||||
Events.on(StateChangeEvent.class, event -> {
|
||||
if((event.from == State.playing && event.to == State.menu) || (event.from == State.menu && event.to != State.menu)){
|
||||
Time.runTask(5f, platform::updateRPC);
|
||||
for(Sound sound : assets.getAll(Sound.class, new Array<>())){
|
||||
for(Sound sound : assets.getAll(Sound.class, new Seq<>())){
|
||||
sound.stop();
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class NetClient implements ApplicationListener{
|
||||
private ReusableByteInStream byteStream = new ReusableByteInStream();
|
||||
private DataInputStream dataStream = new DataInputStream(byteStream);
|
||||
/** Packet handlers for custom types of messages. */
|
||||
private ObjectMap<String, Array<Cons<String>>> customPacketHandlers = new ObjectMap<>();
|
||||
private ObjectMap<String, Seq<Cons<String>>> customPacketHandlers = new ObjectMap<>();
|
||||
|
||||
public NetClient(){
|
||||
|
||||
@ -130,11 +130,11 @@ public class NetClient implements ApplicationListener{
|
||||
}
|
||||
|
||||
public void addPacketHandler(String type, Cons<String> handler){
|
||||
customPacketHandlers.get(type, Array::new).add(handler);
|
||||
customPacketHandlers.get(type, Seq::new).add(handler);
|
||||
}
|
||||
|
||||
public Array<Cons<String>> getPacketHandlers(String type){
|
||||
return customPacketHandlers.get(type, Array::new);
|
||||
public Seq<Cons<String>> getPacketHandlers(String type){
|
||||
return customPacketHandlers.get(type, Seq::new);
|
||||
}
|
||||
|
||||
@Remote(targets = Loc.server, variants = Variant.both)
|
||||
|
@ -75,7 +75,7 @@ public class NetServer implements ApplicationListener{
|
||||
/** Data stream for writing player sync data to. */
|
||||
private DataOutputStream dataStream = new DataOutputStream(syncStream);
|
||||
/** Packet handlers for custom types of messages. */
|
||||
private ObjectMap<String, Array<Cons2<Playerc, String>>> customPacketHandlers = new ObjectMap<>();
|
||||
private ObjectMap<String, Seq<Cons2<Playerc, String>>> customPacketHandlers = new ObjectMap<>();
|
||||
|
||||
public NetServer(){
|
||||
|
||||
@ -140,8 +140,8 @@ public class NetServer implements ApplicationListener{
|
||||
return;
|
||||
}
|
||||
|
||||
Array<String> extraMods = packet.mods.copy();
|
||||
Array<String> missingMods = mods.getIncompatibility(extraMods);
|
||||
Seq<String> extraMods = packet.mods.copy();
|
||||
Seq<String> missingMods = mods.getIncompatibility(extraMods);
|
||||
|
||||
if(!extraMods.isEmpty() || !missingMods.isEmpty()){
|
||||
//can't easily be localized since kick reasons can't have formatted text with them
|
||||
@ -481,11 +481,11 @@ public class NetServer implements ApplicationListener{
|
||||
}
|
||||
|
||||
public void addPacketHandler(String type, Cons2<Playerc, String> handler){
|
||||
customPacketHandlers.get(type, Array::new).add(handler);
|
||||
customPacketHandlers.get(type, Seq::new).add(handler);
|
||||
}
|
||||
|
||||
public Array<Cons2<Playerc, String>> getPacketHandlers(String type){
|
||||
return customPacketHandlers.get(type, Array::new);
|
||||
public Seq<Cons2<Playerc, String>> getPacketHandlers(String type){
|
||||
return customPacketHandlers.get(type, Seq::new);
|
||||
}
|
||||
|
||||
public static void onDisconnect(Playerc player, String reason){
|
||||
@ -797,7 +797,7 @@ public class NetServer implements ApplicationListener{
|
||||
|
||||
public void writeEntitySnapshot(Playerc player) throws IOException{
|
||||
syncStream.reset();
|
||||
Array<CoreEntity> cores = state.teams.cores(player.team());
|
||||
Seq<CoreEntity> cores = state.teams.cores(player.team());
|
||||
|
||||
dataStream.writeByte(cores.size);
|
||||
|
||||
|
@ -36,8 +36,8 @@ public interface Platform{
|
||||
default void viewListingID(String mapid){}
|
||||
|
||||
/** Steam: Return external workshop maps to be loaded.*/
|
||||
default Array<Fi> getWorkshopContent(Class<? extends Publishable> type){
|
||||
return new Array<>(0);
|
||||
default Seq<Fi> getWorkshopContent(Class<? extends Publishable> type){
|
||||
return new Seq<>(0);
|
||||
}
|
||||
|
||||
/** Steam: Open workshop for maps.*/
|
||||
|
@ -86,7 +86,7 @@ public class UI implements ApplicationListener, Loadable{
|
||||
Fonts.def.getData().markupEnabled = true;
|
||||
Fonts.def.setOwnsTexture(false);
|
||||
|
||||
Core.assets.getAll(BitmapFont.class, new Array<>()).each(font -> font.setUseIntegerPositions(true));
|
||||
Core.assets.getAll(BitmapFont.class, new Seq<>()).each(font -> font.setUseIntegerPositions(true));
|
||||
Core.scene = new Scene();
|
||||
Core.input.addProcessor(Core.scene);
|
||||
|
||||
@ -118,8 +118,8 @@ public class UI implements ApplicationListener, Loadable{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Array<AssetDescriptor> getDependencies(){
|
||||
return Array.with(new AssetDescriptor<>(Control.class), new AssetDescriptor<>("outline", BitmapFont.class), new AssetDescriptor<>("default", BitmapFont.class), new AssetDescriptor<>("chat", BitmapFont.class));
|
||||
public Seq<AssetDescriptor> getDependencies(){
|
||||
return Seq.with(new AssetDescriptor<>(Control.class), new AssetDescriptor<>("outline", BitmapFont.class), new AssetDescriptor<>("default", BitmapFont.class), new AssetDescriptor<>("chat", BitmapFont.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -527,7 +527,7 @@ public class World{
|
||||
|
||||
@Override
|
||||
public void end(){
|
||||
Array<GenerateFilter> filters = map.filters();
|
||||
Seq<GenerateFilter> filters = map.filters();
|
||||
|
||||
if(!filters.isEmpty()){
|
||||
//input for filter queries
|
||||
|
@ -1,7 +1,7 @@
|
||||
package mindustry.editor;
|
||||
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import arc.struct.LongArray;
|
||||
import arc.struct.LongSeq;
|
||||
import mindustry.game.Team;
|
||||
import mindustry.gen.TileOp;
|
||||
import mindustry.world.Block;
|
||||
@ -12,7 +12,7 @@ import static mindustry.Vars.content;
|
||||
|
||||
public class DrawOperation{
|
||||
private MapEditor editor;
|
||||
private LongArray array = new LongArray();
|
||||
private LongSeq array = new LongSeq();
|
||||
|
||||
public DrawOperation(MapEditor editor) {
|
||||
this.editor = editor;
|
||||
|
@ -91,7 +91,7 @@ public enum EditorTool{
|
||||
edit = true;
|
||||
}
|
||||
|
||||
IntArray stack = new IntArray();
|
||||
IntSeq stack = new IntSeq();
|
||||
|
||||
@Override
|
||||
public void touched(MapEditor editor, int x, int y){
|
||||
@ -200,7 +200,7 @@ public enum EditorTool{
|
||||
stack = null;
|
||||
System.gc();
|
||||
e.printStackTrace();
|
||||
stack = new IntArray();
|
||||
stack = new IntSeq();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
private Rules lastSavedRules;
|
||||
private boolean saved = false;
|
||||
private boolean shownWithMap = false;
|
||||
private Array<Block> blocksOut = new Array<>();
|
||||
private Seq<Block> blocksOut = new Seq<>();
|
||||
|
||||
public MapEditorDialog(){
|
||||
super("");
|
||||
|
@ -38,7 +38,7 @@ public class MapGenerateDialog extends BaseDialog{
|
||||
private Pixmap pixmap;
|
||||
private Texture texture;
|
||||
private GenerateInput input = new GenerateInput();
|
||||
private Array<GenerateFilter> filters = new Array<>();
|
||||
private Seq<GenerateFilter> filters = new Seq<>();
|
||||
private int scaling = mobile ? 3 : 1;
|
||||
private Table filterTable;
|
||||
|
||||
@ -48,7 +48,7 @@ public class MapGenerateDialog extends BaseDialog{
|
||||
private GenTile returnTile = new GenTile();
|
||||
|
||||
private GenTile[][] buffer1, buffer2;
|
||||
private Cons<Array<GenerateFilter>> applier;
|
||||
private Cons<Seq<GenerateFilter>> applier;
|
||||
private CachedTile ctile = new CachedTile(){
|
||||
//nothing.
|
||||
@Override
|
||||
@ -95,18 +95,18 @@ public class MapGenerateDialog extends BaseDialog{
|
||||
onResize(this::rebuildFilters);
|
||||
}
|
||||
|
||||
public void show(Array<GenerateFilter> filters, Cons<Array<GenerateFilter>> applier){
|
||||
public void show(Seq<GenerateFilter> filters, Cons<Seq<GenerateFilter>> applier){
|
||||
this.filters = filters;
|
||||
this.applier = applier;
|
||||
show();
|
||||
}
|
||||
|
||||
public void show(Cons<Array<GenerateFilter>> applier){
|
||||
public void show(Cons<Seq<GenerateFilter>> applier){
|
||||
show(this.filters, applier);
|
||||
}
|
||||
|
||||
/** Applies the specified filters to the editor. */
|
||||
public void applyToEditor(Array<GenerateFilter> filters){
|
||||
public void applyToEditor(Seq<GenerateFilter> filters){
|
||||
//writeback buffer
|
||||
GenTile[][] writeTiles = new GenTile[editor.width()][editor.height()];
|
||||
|
||||
@ -342,7 +342,7 @@ public class MapGenerateDialog extends BaseDialog{
|
||||
return;
|
||||
}
|
||||
|
||||
Array<GenerateFilter> copy = new Array<>(filters);
|
||||
Seq<GenerateFilter> copy = new Seq<>(filters);
|
||||
|
||||
result = executor.submit(() -> {
|
||||
try{
|
||||
|
@ -1,10 +1,10 @@
|
||||
package mindustry.editor;
|
||||
|
||||
import arc.struct.Array;
|
||||
import arc.struct.Seq;
|
||||
|
||||
public class OperationStack{
|
||||
private final static int maxSize = 10;
|
||||
private Array<DrawOperation> stack = new Array<>();
|
||||
private Seq<DrawOperation> stack = new Seq<>();
|
||||
private int index = 0;
|
||||
|
||||
public OperationStack(){
|
||||
|
@ -26,7 +26,7 @@ import static mindustry.game.SpawnGroup.never;
|
||||
|
||||
public class WaveInfoDialog extends BaseDialog{
|
||||
private final static int displayed = 20;
|
||||
private Array<SpawnGroup> groups = new Array<>();
|
||||
private Seq<SpawnGroup> groups = new Seq<>();
|
||||
|
||||
private Table table, preview;
|
||||
private int start = 0;
|
||||
@ -87,7 +87,7 @@ public class WaveInfoDialog extends BaseDialog{
|
||||
main.pane(t -> table = t).growX().growY().padRight(8f).get().setScrollingDisabled(true, false);
|
||||
main.row();
|
||||
main.button("$add", () -> {
|
||||
if(groups == null) groups = new Array<>();
|
||||
if(groups == null) groups = new Seq<>();
|
||||
groups.add(new SpawnGroup(lastType));
|
||||
buildGroups();
|
||||
}).growX().height(70f);
|
||||
|
@ -22,7 +22,7 @@ public class EntityCollisions{
|
||||
private Rect r2 = new Rect();
|
||||
|
||||
//entity collisions
|
||||
private Array<Hitboxc> arrOut = new Array<>();
|
||||
private Seq<Hitboxc> arrOut = new Seq<>();
|
||||
|
||||
public void move(Hitboxc entity, float deltax, float deltay){
|
||||
move(entity, deltax, deltay, EntityCollisions::solid);
|
||||
|
@ -15,8 +15,8 @@ import static mindustry.Vars.collisions;
|
||||
public class EntityGroup<T extends Entityc> implements Iterable<T>{
|
||||
private static int lastId = 0;
|
||||
|
||||
private final Array<T> array;
|
||||
private final Array<T> intersectArray = new Array<>();
|
||||
private final Seq<T> array;
|
||||
private final Seq<T> intersectArray = new Seq<>();
|
||||
private final Rect viewport = new Rect();
|
||||
private final Rect intersectRect = new Rect();
|
||||
private IntMap<T> map;
|
||||
@ -30,7 +30,7 @@ public class EntityGroup<T extends Entityc> implements Iterable<T>{
|
||||
}
|
||||
|
||||
public EntityGroup(Class<T> type, boolean spatial, boolean mapping){
|
||||
array = new Array<>(false, 32, type);
|
||||
array = new Seq<>(false, 32, type);
|
||||
|
||||
if(spatial){
|
||||
tree = new QuadTree<>(new Rect(0, 0, 0, 0));
|
||||
@ -57,7 +57,7 @@ public class EntityGroup<T extends Entityc> implements Iterable<T>{
|
||||
each(Entityc::update);
|
||||
}
|
||||
|
||||
public void copy(Array arr){
|
||||
public void copy(Seq arr){
|
||||
arr.addAll(array);
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ public class EntityGroup<T extends Entityc> implements Iterable<T>{
|
||||
tree.intersect(height, x, y, width, out);
|
||||
}
|
||||
|
||||
public Array<T> intersect(float x, float y, float width, float height){
|
||||
public Seq<T> intersect(float x, float y, float width, float height){
|
||||
intersectArray.clear();
|
||||
//don't waste time for empty groups
|
||||
if(isEmpty()) return intersectArray;
|
||||
|
@ -14,7 +14,7 @@ import static mindustry.Vars.*;
|
||||
public class Lightning{
|
||||
private static final Rand random = new Rand();
|
||||
private static final Rect rect = new Rect();
|
||||
private static final Array<Unitc> entities = new Array<>();
|
||||
private static final Seq<Unitc> entities = new Seq<>();
|
||||
private static final IntSet hit = new IntSet();
|
||||
private static final int maxChain = 8;
|
||||
private static final float hitRange = 30f;
|
||||
@ -32,7 +32,7 @@ public class Lightning{
|
||||
random.setSeed(seed);
|
||||
hit.clear();
|
||||
|
||||
Array<Vec2> lines = new Array<>();
|
||||
Seq<Vec2> lines = new Seq<>();
|
||||
bhit = false;
|
||||
|
||||
for(int i = 0; i < length / 2; i++){
|
||||
|
@ -19,7 +19,7 @@ import static mindustry.Vars.*;
|
||||
abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Drawc, Shielderc, Ownerc, Velc, Bulletc, Timerc{
|
||||
@Import Team team;
|
||||
|
||||
IntArray collided = new IntArray(6);
|
||||
IntSeq collided = new IntSeq(6);
|
||||
Object data;
|
||||
BulletType type;
|
||||
float damage;
|
||||
|
@ -11,12 +11,12 @@ import mindustry.gen.*;
|
||||
/** A unit that can command other units. */
|
||||
@Component
|
||||
abstract class CommanderComp implements Unitc{
|
||||
private static final Array<FormationMember> members = new Array<>();
|
||||
private static final Seq<FormationMember> members = new Seq<>();
|
||||
|
||||
@Import float x, y, rotation;
|
||||
|
||||
transient @Nullable Formation formation;
|
||||
transient Array<Unitc> controlling = new Array<>();
|
||||
transient Seq<Unitc> controlling = new Seq<>();
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
@ -42,7 +42,7 @@ abstract class CommanderComp implements Unitc{
|
||||
clearCommand();
|
||||
}
|
||||
|
||||
void command(Formation formation, Array<Unitc> units){
|
||||
void command(Formation formation, Seq<Unitc> units){
|
||||
clearCommand();
|
||||
|
||||
controlling.addAll(units);
|
||||
|
@ -15,7 +15,7 @@ import mindustry.world.blocks.payloads.*;
|
||||
abstract class PayloadComp implements Posc, Rotc{
|
||||
@Import float x, y, rotation;
|
||||
|
||||
Array<Payload> payloads = new Array<>();
|
||||
Seq<Payload> payloads = new Seq<>();
|
||||
|
||||
boolean hasPayload(){
|
||||
return payloads.size > 0;
|
||||
|
@ -17,7 +17,7 @@ import static mindustry.Vars.content;
|
||||
|
||||
@Component
|
||||
abstract class StatusComp implements Posc, Flyingc{
|
||||
private Array<StatusEntry> statuses = new Array<>();
|
||||
private Seq<StatusEntry> statuses = new Seq<>();
|
||||
private transient Bits applied = new Bits(content.getBy(ContentType.status).size);
|
||||
|
||||
@ReadOnly transient float speedMultiplier, damageMultiplier, armorMultiplier;
|
||||
|
@ -41,8 +41,8 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
|
||||
//region vars and initialization
|
||||
static final float timeToSleep = 60f * 1;
|
||||
static final ObjectSet<Tilec> tmpTiles = new ObjectSet<>();
|
||||
static final Array<Tilec> tempTileEnts = new Array<>();
|
||||
static final Array<Tile> tempTiles = new Array<>();
|
||||
static final Seq<Tilec> tempTileEnts = new Seq<>();
|
||||
static final Seq<Tile> tempTiles = new Seq<>();
|
||||
static int sleepingEntities = 0;
|
||||
|
||||
@Import float x, y, health;
|
||||
@ -50,7 +50,7 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
|
||||
|
||||
transient Tile tile;
|
||||
transient Block block;
|
||||
transient Array<Tilec> proximity = new Array<>(8);
|
||||
transient Seq<Tilec> proximity = new Seq<>(8);
|
||||
transient boolean updateFlow;
|
||||
|
||||
PowerModule power;
|
||||
@ -548,7 +548,7 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
|
||||
* containers, it gets added to the block's inventory.
|
||||
*/
|
||||
public void offload(Item item){
|
||||
Array<Tilec> proximity = proximity();
|
||||
Seq<Tilec> proximity = proximity();
|
||||
int dump = tile.data;
|
||||
useContent(item);
|
||||
|
||||
@ -568,7 +568,7 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
|
||||
* Tries to put this item into a nearby container. Returns success. Unlike #offload(), this method does not change the block inventory.
|
||||
*/
|
||||
public boolean put(Item item){
|
||||
Array<Tilec> proximity = proximity();
|
||||
Seq<Tilec> proximity = proximity();
|
||||
int dump = tile.data;
|
||||
useContent(item);
|
||||
|
||||
@ -596,7 +596,7 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
|
||||
public boolean dump(Item todump){
|
||||
if(!block.hasItems || items.total() == 0 || (todump != null && !items.has(todump))) return false;
|
||||
|
||||
Array<Tilec> proximity = proximity();
|
||||
Seq<Tilec> proximity = proximity();
|
||||
int dump = tile.data;
|
||||
|
||||
if(proximity.size == 0) return false;
|
||||
@ -683,7 +683,7 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
|
||||
}
|
||||
}
|
||||
|
||||
public Array<Tilec> getPowerConnections(Array<Tilec> out){
|
||||
public Seq<Tilec> getPowerConnections(Seq<Tilec> out){
|
||||
out.clear();
|
||||
if(power == null) return out;
|
||||
|
||||
@ -995,7 +995,7 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
|
||||
|
||||
/** Returns whether or not a hand cursor should be shown over this block. */
|
||||
public Cursor getCursor(){
|
||||
return block.configurable && tile.team() == player.team() ? SystemCursor.hand : SystemCursor.arrow;
|
||||
return block.configurable ? SystemCursor.hand : SystemCursor.arrow;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,15 +1,15 @@
|
||||
package mindustry.game;
|
||||
|
||||
import arc.struct.Array;
|
||||
import arc.struct.Seq;
|
||||
import mindustry.content.*;
|
||||
import mindustry.type.ItemStack;
|
||||
|
||||
public class DefaultWaves{
|
||||
private Array<SpawnGroup> spawns;
|
||||
private Seq<SpawnGroup> spawns;
|
||||
|
||||
public Array<SpawnGroup> get(){
|
||||
public Seq<SpawnGroup> get(){
|
||||
if(spawns == null && UnitTypes.dagger != null){
|
||||
spawns = Array.with(
|
||||
spawns = Seq.with(
|
||||
new SpawnGroup(UnitTypes.dagger){{
|
||||
end = 10;
|
||||
unitScaling = 2f;
|
||||
@ -186,6 +186,6 @@ public class DefaultWaves{
|
||||
}}
|
||||
);
|
||||
}
|
||||
return spawns == null ? new Array<>() : spawns;
|
||||
return spawns == null ? new Seq<>() : spawns;
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class GlobalData{
|
||||
private boolean modified;
|
||||
|
||||
public void exportData(Fi file) throws IOException{
|
||||
Array<Fi> files = new Array<>();
|
||||
Seq<Fi> files = new Seq<>();
|
||||
files.add(Core.settings.getSettingsFile());
|
||||
files.addAll(customMapDirectory.list());
|
||||
files.addAll(saveDirectory.list());
|
||||
@ -85,7 +85,7 @@ public class GlobalData{
|
||||
modified = true;
|
||||
}
|
||||
|
||||
public boolean hasItems(Array<ItemStack> stacks){
|
||||
public boolean hasItems(Seq<ItemStack> stacks){
|
||||
return !stacks.contains(s -> items.get(s.item, 0) < s.amount);
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ public class GlobalData{
|
||||
}
|
||||
}
|
||||
|
||||
public void removeItems(Array<ItemStack> stacks){
|
||||
public void removeItems(Seq<ItemStack> stacks){
|
||||
for(ItemStack stack : stacks){
|
||||
remove(stack.item, stack.amount);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class Rules{
|
||||
/** Sector for saves that have them.*/
|
||||
public @Nullable Sector sector;
|
||||
/** Spawn layout. */
|
||||
public Array<SpawnGroup> spawns = new Array<>();
|
||||
public Seq<SpawnGroup> spawns = new Seq<>();
|
||||
/** Whether to pause the wave timer until all enemies are destroyed. */
|
||||
public boolean waitEnemies = false;
|
||||
/** Determinates if gamemode is attack mode */
|
||||
@ -74,9 +74,9 @@ public class Rules{
|
||||
/** EXPERIMENTAL building AI. TODO remove */
|
||||
public boolean buildAI = true;
|
||||
/** Starting items put in cores */
|
||||
public Array<ItemStack> loadout = Array.with(ItemStack.with(Items.copper, 100));
|
||||
public Seq<ItemStack> loadout = Seq.with(ItemStack.with(Items.copper, 100));
|
||||
/** Weather events that occur here. */
|
||||
public Array<WeatherEntry> weather = new Array<>(1);
|
||||
public Seq<WeatherEntry> weather = new Seq<>(1);
|
||||
/** Blocks that cannot be placed. */
|
||||
public ObjectSet<Block> bannedBlocks = new ObjectSet<>();
|
||||
/** Whether everything is dark. Enables lights. Experimental. */
|
||||
|
@ -23,7 +23,7 @@ import java.util.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class Saves{
|
||||
private Array<SaveSlot> saves = new Array<>();
|
||||
private Seq<SaveSlot> saves = new Seq<>();
|
||||
private @Nullable SaveSlot current;
|
||||
private @Nullable SaveSlot lastSectorSave;
|
||||
private AsyncExecutor previewExecutor = new AsyncExecutor(1);
|
||||
@ -160,7 +160,7 @@ public class Saves{
|
||||
return file;
|
||||
}
|
||||
|
||||
public Array<SaveSlot> getSaveSlots(){
|
||||
public Seq<SaveSlot> getSaveSlots(){
|
||||
return saves;
|
||||
}
|
||||
|
||||
@ -259,7 +259,7 @@ public class Saves{
|
||||
}
|
||||
|
||||
public void cautiousLoad(Runnable run){
|
||||
Array<String> mods = Array.with(getMods());
|
||||
Seq<String> mods = Seq.with(getMods());
|
||||
mods.removeAll(Vars.mods.getModStrings());
|
||||
|
||||
if(!mods.isEmpty()){
|
||||
|
@ -14,21 +14,21 @@ import mindustry.world.blocks.storage.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class Schematic implements Publishable, Comparable<Schematic>{
|
||||
public final Array<Stile> tiles;
|
||||
public final Seq<Stile> tiles;
|
||||
public StringMap tags;
|
||||
public int width, height;
|
||||
public @Nullable Fi file;
|
||||
/** Associated mod. If null, no mod is associated with this schematic. */
|
||||
public @Nullable LoadedMod mod;
|
||||
|
||||
public Schematic(Array<Stile> tiles, @NonNull StringMap tags, int width, int height){
|
||||
public Schematic(Seq<Stile> tiles, @NonNull StringMap tags, int width, int height){
|
||||
this.tiles = tiles;
|
||||
this.tags = tags;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public Array<ItemStack> requirements(){
|
||||
public Seq<ItemStack> requirements(){
|
||||
IntIntMap amounts = new IntIntMap();
|
||||
|
||||
tiles.each(t -> {
|
||||
@ -36,7 +36,7 @@ public class Schematic implements Publishable, Comparable<Schematic>{
|
||||
amounts.getAndIncrement(stack.item.id, 0, stack.amount);
|
||||
}
|
||||
});
|
||||
Array<ItemStack> stacks = new Array<>();
|
||||
Seq<ItemStack> stacks = new Seq<>();
|
||||
for(Entry ent : amounts.entries()){
|
||||
stacks.add(new ItemStack(Vars.content.item(ent.key), ent.value));
|
||||
}
|
||||
|
@ -40,8 +40,8 @@ import static mindustry.Vars.*;
|
||||
|
||||
/** Handles schematics.*/
|
||||
public class Schematics implements Loadable{
|
||||
private static final Schematic tmpSchem = new Schematic(new Array<>(), new StringMap(), 0, 0);
|
||||
private static final Schematic tmpSchem2 = new Schematic(new Array<>(), new StringMap(), 0, 0);
|
||||
private static final Schematic tmpSchem = new Schematic(new Seq<>(), new StringMap(), 0, 0);
|
||||
private static final Schematic tmpSchem2 = new Schematic(new Seq<>(), new StringMap(), 0, 0);
|
||||
public static final String base64Header = "bXNjaAB";
|
||||
|
||||
private static final byte[] header = {'m', 's', 'c', 'h'};
|
||||
@ -52,7 +52,7 @@ public class Schematics implements Loadable{
|
||||
private static final int resolution = 32;
|
||||
|
||||
private OptimizedByteArrayOutputStream out = new OptimizedByteArrayOutputStream(1024);
|
||||
private Array<Schematic> all = new Array<>();
|
||||
private Seq<Schematic> all = new Seq<>();
|
||||
private OrderedMap<Schematic, FrameBuffer> previews = new OrderedMap<>();
|
||||
private ObjectSet<Schematic> errored = new ObjectSet<>();
|
||||
private FrameBuffer shadowBuffer;
|
||||
@ -155,7 +155,7 @@ public class Schematics implements Loadable{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Array<Schematic> all(){
|
||||
public Seq<Schematic> all(){
|
||||
return all;
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ public class Schematics implements Loadable{
|
||||
//dispose unneeded previews to prevent memory outage errors.
|
||||
//only runs every 2 seconds
|
||||
if(mobile && Time.timeSinceMillis(lastClearTime) > 1000 * 2 && previews.size > maxPreviewsMobile){
|
||||
Array<Schematic> keys = previews.orderedKeys().copy();
|
||||
Seq<Schematic> keys = previews.orderedKeys().copy();
|
||||
for(int i = 0; i < previews.size - maxPreviewsMobile; i++){
|
||||
//dispose and remove unneeded previews
|
||||
previews.get(keys.get(i)).dispose();
|
||||
@ -246,7 +246,7 @@ public class Schematics implements Loadable{
|
||||
Draw.rect(Tmp.tr1, buffer.getWidth()/2f, buffer.getHeight()/2f, buffer.getWidth(), -buffer.getHeight());
|
||||
Draw.color();
|
||||
|
||||
Array<BuildRequest> requests = schematic.tiles.map(t -> new BuildRequest(t.x, t.y, t.rotation, t.block).configure(t.config));
|
||||
Seq<BuildRequest> requests = schematic.tiles.map(t -> new BuildRequest(t.x, t.y, t.rotation, t.block).configure(t.config));
|
||||
|
||||
Draw.flush();
|
||||
//scale each request to fit schematic
|
||||
@ -276,7 +276,7 @@ public class Schematics implements Loadable{
|
||||
}
|
||||
|
||||
/** Creates an array of build requests from a schematic's data, centered on the provided x+y coordinates. */
|
||||
public Array<BuildRequest> toRequests(Schematic schem, int x, int y){
|
||||
public Seq<BuildRequest> toRequests(Schematic schem, int x, int y){
|
||||
return schem.tiles.map(t -> new BuildRequest(t.x + x - schem.width/2, t.y + y - schem.height/2, t.rotation, t.block).original(t.x, t.y, schem.width, schem.height).configure(t.config))
|
||||
.removeAll(s -> !s.block.isVisible() || !s.block.unlockedCur());
|
||||
}
|
||||
@ -318,7 +318,7 @@ public class Schematics implements Loadable{
|
||||
|
||||
int ox = x, oy = y, ox2 = x2, oy2 = y2;
|
||||
|
||||
Array<Stile> tiles = new Array<>();
|
||||
Seq<Stile> tiles = new Seq<>();
|
||||
|
||||
int minx = x2, miny = y2, maxx = x, maxy = y;
|
||||
boolean found = false;
|
||||
@ -344,7 +344,7 @@ public class Schematics implements Loadable{
|
||||
x2 = maxx;
|
||||
y2 = maxy;
|
||||
}else{
|
||||
return new Schematic(new Array<>(), new StringMap(), 1, 1);
|
||||
return new Schematic(new Seq<>(), new StringMap(), 1, 1);
|
||||
}
|
||||
|
||||
int width = x2 - x + 1, height = y2 - y + 1;
|
||||
@ -466,7 +466,7 @@ public class Schematics implements Loadable{
|
||||
}
|
||||
|
||||
int total = stream.readInt();
|
||||
Array<Stile> tiles = new Array<>(total);
|
||||
Seq<Stile> tiles = new Seq<>(total);
|
||||
for(int i = 0; i < total; i++){
|
||||
Block block = blocks.get(stream.readByte());
|
||||
int position = stream.readInt();
|
||||
|
@ -39,7 +39,7 @@ public class Stats{
|
||||
|
||||
//weigh used fractions
|
||||
float frac = 0f;
|
||||
Array<Item> obtainable = Array.select(zone.data.resources, i -> i instanceof Item && ((Item)i).type == ItemType.material).as();
|
||||
Seq<Item> obtainable = Seq.select(zone.data.resources, i -> i instanceof Item && ((Item)i).type == ItemType.material).as();
|
||||
for(Item item : obtainable){
|
||||
frac += Mathf.clamp((float)itemsDelivered.get(item, 0) / capacity) / (float)obtainable.size;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class Team implements Comparable<Team>{
|
||||
all[us] = this;
|
||||
}
|
||||
|
||||
public Array<Team> enemies(){
|
||||
public Seq<Team> enemies(){
|
||||
return state.teams.enemiesOf(this);
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ public class Team implements Comparable<Team>{
|
||||
return state.teams.areEnemies(this, other);
|
||||
}
|
||||
|
||||
public Array<CoreEntity> cores(){
|
||||
public Seq<CoreEntity> cores(){
|
||||
return state.teams.cores(this);
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ public class Teams{
|
||||
/** Maps team IDs to team data. */
|
||||
private TeamData[] map = new TeamData[256];
|
||||
/** Active teams. */
|
||||
private Array<TeamData> active = new Array<>();
|
||||
private Seq<TeamData> active = new Seq<>();
|
||||
|
||||
public Teams(){
|
||||
active.add(get(Team.crux));
|
||||
@ -38,7 +38,7 @@ public class Teams{
|
||||
return Geometry.findClosest(x, y, get(team).cores);
|
||||
}
|
||||
|
||||
public Array<Team> enemiesOf(Team team){
|
||||
public Seq<Team> enemiesOf(Team team){
|
||||
return get(team).enemies;
|
||||
}
|
||||
|
||||
@ -73,12 +73,12 @@ public class Teams{
|
||||
return map[Pack.u(team.id)];
|
||||
}
|
||||
|
||||
public Array<CoreEntity> playerCores(){
|
||||
public Seq<CoreEntity> playerCores(){
|
||||
return get(state.rules.defaultTeam).cores;
|
||||
}
|
||||
|
||||
/** Do not modify! */
|
||||
public Array<CoreEntity> cores(Team team){
|
||||
public Seq<CoreEntity> cores(Team team){
|
||||
return get(team).cores;
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ public class Teams{
|
||||
}
|
||||
|
||||
/** Do not modify. */
|
||||
public Array<TeamData> getActive(){
|
||||
public Seq<TeamData> getActive(){
|
||||
active.removeAll(t -> !t.active());
|
||||
return active;
|
||||
}
|
||||
@ -145,8 +145,8 @@ public class Teams{
|
||||
}
|
||||
|
||||
public class TeamData{
|
||||
public final Array<CoreEntity> cores = new Array<>();
|
||||
public final Array<Team> enemies = new Array<>();
|
||||
public final Seq<CoreEntity> cores = new Seq<>();
|
||||
public final Seq<Team> enemies = new Seq<>();
|
||||
public final Team team;
|
||||
public final BaseAI ai;
|
||||
public Queue<BlockPlan> blocks = new Queue<>();
|
||||
|
@ -195,7 +195,7 @@ public class Tutorial{
|
||||
|
||||
protected String line = "";
|
||||
protected final Func<String, String> text;
|
||||
protected Array<String> sentences;
|
||||
protected Seq<String> sentences;
|
||||
protected final Boolp done;
|
||||
|
||||
TutorialStage(Func<String, String> text, Boolp done){
|
||||
@ -218,7 +218,7 @@ public class Tutorial{
|
||||
|
||||
void load(){
|
||||
this.line = Core.bundle.has("tutorial." + name() + ".mobile") && mobile ? "tutorial." + name() + ".mobile" : "tutorial." + name();
|
||||
this.sentences = Array.select(Core.bundle.get(line).split("\n"), s -> !s.isEmpty());
|
||||
this.sentences = Seq.select(Core.bundle.get(line).split("\n"), s -> !s.isEmpty());
|
||||
}
|
||||
|
||||
/** called every frame when this stage is active.*/
|
||||
|
@ -26,14 +26,14 @@ public class BlockRenderer implements Disposable{
|
||||
|
||||
public final FloorRenderer floor = new FloorRenderer();
|
||||
|
||||
private Array<Tile> requests = new Array<>(false, initialRequests, Tile.class);
|
||||
private Seq<Tile> requests = new Seq<>(false, initialRequests, Tile.class);
|
||||
|
||||
private int lastCamX, lastCamY, lastRangeX, lastRangeY;
|
||||
private float brokenFade = 0f;
|
||||
private FrameBuffer shadows = new FrameBuffer();
|
||||
private FrameBuffer fog = new FrameBuffer();
|
||||
private Array<Tilec> outArray2 = new Array<>();
|
||||
private Array<Tile> shadowEvents = new Array<>();
|
||||
private Seq<Tilec> outArray2 = new Seq<>();
|
||||
private Seq<Tile> shadowEvents = new Seq<>();
|
||||
private boolean displayStatus = false;
|
||||
|
||||
public BlockRenderer(){
|
||||
|
@ -24,7 +24,7 @@ public class FloorRenderer implements Disposable{
|
||||
private MultiCacheBatch cbatch;
|
||||
private IntSet drawnLayerSet = new IntSet();
|
||||
private IntSet recacheSet = new IntSet();
|
||||
private IntArray drawnLayers = new IntArray();
|
||||
private IntSeq drawnLayers = new IntSeq();
|
||||
private ObjectSet<CacheLayer> used = new ObjectSet<>();
|
||||
|
||||
public FloorRenderer(){
|
||||
|
@ -18,7 +18,7 @@ public class LightRenderer{
|
||||
|
||||
private float[] vertices = new float[24];
|
||||
private FrameBuffer buffer = new FrameBuffer();
|
||||
private Array<Runnable> lights = new Array<>();
|
||||
private Seq<Runnable> lights = new Seq<>();
|
||||
|
||||
public void add(Runnable run){
|
||||
if(!enabled()) return;
|
||||
|
@ -26,7 +26,7 @@ public class LoadRenderer implements Disposable{
|
||||
private static final Color colorRed = Pal.breakInvalid.cpy().lerp(Color.black, 0.3f);
|
||||
private static final String red = "[#" + colorRed + "]";
|
||||
private static final String orange = "[#" + color + "]";
|
||||
private static final FloatArray floats = new FloatArray();
|
||||
private static final FloatSeq floats = new FloatSeq();
|
||||
private static final boolean preview = false;
|
||||
|
||||
private float testprogress = 0f;
|
||||
|
@ -42,7 +42,7 @@ public class MenuRenderer implements Disposable{
|
||||
private void generate(){
|
||||
world.beginMapLoad();
|
||||
Tiles tiles = world.resize(width, height);
|
||||
Array<Block> ores = content.blocks().select(b -> b instanceof OreBlock);
|
||||
Seq<Block> ores = content.blocks().select(b -> b instanceof OreBlock);
|
||||
shadows = new FrameBuffer(width, height);
|
||||
int offset = Mathf.random(100000);
|
||||
Simplex s1 = new Simplex(offset);
|
||||
|
@ -22,7 +22,7 @@ import static mindustry.Vars.*;
|
||||
|
||||
public class MinimapRenderer implements Disposable{
|
||||
private static final float baseSize = 16f;
|
||||
private final Array<Unitc> units = new Array<>();
|
||||
private final Seq<Unitc> units = new Seq<>();
|
||||
private Pixmap pixmap;
|
||||
private Texture texture;
|
||||
private TextureRegion region;
|
||||
|
@ -9,7 +9,7 @@ import arc.util.pooling.*;
|
||||
|
||||
public class Trail{
|
||||
private static final int length = 20;
|
||||
private Array<Vec3> points = new Array<>();
|
||||
private Seq<Vec3> points = new Seq<>();
|
||||
private float lastX = -1, lastY = -1;
|
||||
|
||||
public void draw(Color color, float width){
|
||||
|
@ -22,7 +22,7 @@ public class PlanetRenderer implements Disposable{
|
||||
borderColor = Pal.accent.cpy().a(0.3f),
|
||||
shadowColor = new Color(0, 0, 0, 0.7f);
|
||||
|
||||
private static final Array<Vec3> points = new Array<>();
|
||||
private static final Seq<Vec3> points = new Seq<>();
|
||||
private static final PlanetInterfaceRenderer emptyRenderer = new PlanetInterfaceRenderer(){
|
||||
@Override public void renderSectors(Planet planet){}
|
||||
@Override public void renderProjections(){}
|
||||
|
@ -47,7 +47,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
final static int maxLength = 100;
|
||||
final static Vec2 stackTrns = new Vec2();
|
||||
final static Rect r1 = new Rect(), r2 = new Rect();
|
||||
final static Array<Unitc> units = new Array<>();
|
||||
final static Seq<Unitc> units = new Seq<>();
|
||||
/** Distance on the back from where items originate. */
|
||||
final static float backTrns = 3f;
|
||||
|
||||
@ -66,8 +66,8 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
protected PlaceLine line = new PlaceLine();
|
||||
protected BuildRequest resultreq;
|
||||
protected BuildRequest brequest = new BuildRequest();
|
||||
protected Array<BuildRequest> lineRequests = new Array<>();
|
||||
protected Array<BuildRequest> selectRequests = new Array<>();
|
||||
protected Seq<BuildRequest> lineRequests = new Seq<>();
|
||||
protected Seq<BuildRequest> selectRequests = new Seq<>();
|
||||
|
||||
//methods to override
|
||||
|
||||
@ -362,7 +362,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
});
|
||||
}
|
||||
|
||||
public void rotateRequests(Array<BuildRequest> requests, int direction){
|
||||
public void rotateRequests(Seq<BuildRequest> requests, int direction){
|
||||
int ox = schemOriginX(), oy = schemOriginY();
|
||||
|
||||
requests.each(req -> {
|
||||
@ -396,7 +396,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
});
|
||||
}
|
||||
|
||||
public void flipRequests(Array<BuildRequest> requests, boolean x){
|
||||
public void flipRequests(Seq<BuildRequest> requests, boolean x){
|
||||
int origin = (x ? schemOriginX() : schemOriginY()) * tilesize;
|
||||
|
||||
requests.each(req -> {
|
||||
@ -533,7 +533,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
Lines.rect(result.x, result.y, result.x2 - result.x, result.y2 - result.y);
|
||||
}
|
||||
|
||||
protected void flushSelectRequests(Array<BuildRequest> requests){
|
||||
protected void flushSelectRequests(Seq<BuildRequest> requests){
|
||||
for(BuildRequest req : requests){
|
||||
if(req.block != null && validPlace(req.x, req.y, req.block, req.rotation)){
|
||||
BuildRequest other = getRequest(req.x, req.y, req.block.size, null);
|
||||
@ -547,7 +547,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
}
|
||||
|
||||
protected void flushRequests(Array<BuildRequest> requests){
|
||||
protected void flushRequests(Seq<BuildRequest> requests){
|
||||
for(BuildRequest req : requests){
|
||||
if(req.block != null && validPlace(req.x, req.y, req.block, req.rotation)){
|
||||
BuildRequest copy = req.copy();
|
||||
@ -953,7 +953,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
|
||||
void iterateLine(int startX, int startY, int endX, int endY, Cons<PlaceLine> cons){
|
||||
Array<Point2> points;
|
||||
Seq<Point2> points;
|
||||
boolean diagonal = Core.input.keyDown(Binding.diagonal_placement);
|
||||
|
||||
if(Core.settings.getBool("swapdiagonal") && mobile){
|
||||
@ -971,7 +971,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
|
||||
if(block instanceof PowerNode){
|
||||
Array<Point2> skip = new Array<>();
|
||||
Seq<Point2> skip = new Seq<>();
|
||||
|
||||
for(int i = 1; i < points.size; i++){
|
||||
int overlaps = 0;
|
||||
|
@ -48,7 +48,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
private float shiftDeltaX, shiftDeltaY;
|
||||
|
||||
/** Place requests to be removed. */
|
||||
private Array<BuildRequest> removals = new Array<>();
|
||||
private Seq<BuildRequest> removals = new Seq<>();
|
||||
/** Whether or not the player is currently shifting all placed tiles. */
|
||||
private boolean selecting;
|
||||
/** Whether the player is currently in line-place mode. */
|
||||
|
@ -13,7 +13,7 @@ public class Placement{
|
||||
private static final NormalizeResult result = new NormalizeResult();
|
||||
private static final NormalizeDrawResult drawResult = new NormalizeDrawResult();
|
||||
private static Bresenham2 bres = new Bresenham2();
|
||||
private static Array<Point2> points = new Array<>();
|
||||
private static Seq<Point2> points = new Seq<>();
|
||||
|
||||
//for pathfinding
|
||||
private static IntFloatMap costs = new IntFloatMap();
|
||||
@ -21,7 +21,7 @@ public class Placement{
|
||||
private static IntSet closed = new IntSet();
|
||||
|
||||
/** Normalize a diagonal line into points. */
|
||||
public static Array<Point2> pathfindLine(boolean conveyors, int startX, int startY, int endX, int endY){
|
||||
public static Seq<Point2> pathfindLine(boolean conveyors, int startX, int startY, int endX, int endY){
|
||||
Pools.freeAll(points);
|
||||
|
||||
points.clear();
|
||||
@ -37,7 +37,7 @@ public class Placement{
|
||||
}
|
||||
|
||||
/** Normalize two points into one straight line, no diagonals. */
|
||||
public static Array<Point2> normalizeLine(int startX, int startY, int endX, int endY){
|
||||
public static Seq<Point2> normalizeLine(int startX, int startY, int endX, int endY){
|
||||
Pools.freeAll(points);
|
||||
points.clear();
|
||||
if(Math.abs(startX - endX) > Math.abs(startY - endY)){
|
||||
|
@ -20,7 +20,7 @@ public class SaveIO{
|
||||
/** Format header. This is the string 'MSAV' in ASCII. */
|
||||
public static final byte[] header = {77, 83, 65, 86};
|
||||
public static final IntMap<SaveVersion> versions = new IntMap<>();
|
||||
public static final Array<SaveVersion> versionArray = Array.with(new Save1(), new Save2(), new Save3(), new Save4());
|
||||
public static final Seq<SaveVersion> versionArray = Seq.with(new Save1(), new Save2(), new Save3(), new Save4());
|
||||
|
||||
static{
|
||||
for(SaveVersion version : versionArray){
|
||||
|
@ -270,7 +270,7 @@ public abstract class SaveVersion extends SaveFileReader{
|
||||
|
||||
public void writeEntities(DataOutput stream) throws IOException{
|
||||
//write team data with entities.
|
||||
Array<TeamData> data = state.teams.getActive();
|
||||
Seq<TeamData> data = state.teams.getActive();
|
||||
stream.writeInt(data.size);
|
||||
for(TeamData team : data){
|
||||
stream.writeInt(team.team.id);
|
||||
@ -337,17 +337,17 @@ public abstract class SaveVersion extends SaveFileReader{
|
||||
}
|
||||
|
||||
public void writeContentHeader(DataOutput stream) throws IOException{
|
||||
Array<Content>[] map = content.getContentMap();
|
||||
Seq<Content>[] map = content.getContentMap();
|
||||
|
||||
int mappable = 0;
|
||||
for(Array<Content> arr : map){
|
||||
for(Seq<Content> arr : map){
|
||||
if(arr.size > 0 && arr.first() instanceof MappableContent){
|
||||
mappable++;
|
||||
}
|
||||
}
|
||||
|
||||
stream.writeByte(mappable);
|
||||
for(Array<Content> arr : map){
|
||||
for(Seq<Content> arr : map){
|
||||
if(arr.size > 0 && arr.first() instanceof MappableContent){
|
||||
stream.writeByte(arr.first().getContentType().ordinal());
|
||||
stream.writeShort(arr.size);
|
||||
|
@ -50,9 +50,9 @@ public class TypeIO{
|
||||
write.b((byte)5);
|
||||
write.b((byte)map.getContentType().ordinal());
|
||||
write.s(map.id);
|
||||
}else if(object instanceof IntArray){
|
||||
}else if(object instanceof IntSeq){
|
||||
write.b((byte)6);
|
||||
IntArray arr = (IntArray)object;
|
||||
IntSeq arr = (IntSeq)object;
|
||||
write.s((short)arr.size);
|
||||
for(int i = 0; i < arr.size; i++){
|
||||
write.i(arr.items[i]);
|
||||
@ -81,7 +81,7 @@ public class TypeIO{
|
||||
case 3: return read.f();
|
||||
case 4: return readString(read);
|
||||
case 5: return content.getByID(ContentType.all[read.b()], read.s());
|
||||
case 6: short length = read.s(); IntArray arr = new IntArray(); for(int i = 0; i < length; i ++) arr.add(read.i()); return arr;
|
||||
case 6: short length = read.s(); IntSeq arr = new IntSeq(); for(int i = 0; i < length; i ++) arr.add(read.i()); return arr;
|
||||
case 7: return new Point2(read.i(), read.i());
|
||||
case 8: byte len = read.b(); Point2[] out = new Point2[len]; for(int i = 0; i < len; i ++) out[i] = Point2.unpack(read.i()); return out;
|
||||
default: throw new IllegalArgumentException("Unknown object type: " + type);
|
||||
|
@ -8,8 +8,8 @@ import java.io.*;
|
||||
|
||||
public class LegacyIO{
|
||||
|
||||
public static Array<Server> readServers(){
|
||||
Array<Server> arr = new Array<>();
|
||||
public static Seq<Server> readServers(){
|
||||
Seq<Server> arr = new Seq<>();
|
||||
|
||||
try{
|
||||
byte[] bytes = Core.settings.getBytes("server-list");
|
||||
|
@ -111,9 +111,9 @@ public class Map implements Comparable<Map>, Publishable{
|
||||
}
|
||||
|
||||
/** Returns the generation filters that this map uses on load.*/
|
||||
public Array<GenerateFilter> filters(){
|
||||
public Seq<GenerateFilter> filters(){
|
||||
if(tags.getInt("build", -1) < 83 && tags.getInt("build", -1) != -1 && tags.get("genfilters", "").isEmpty()){
|
||||
return Array.with();
|
||||
return Seq.with();
|
||||
}
|
||||
return maps.readFilters(tags.get("genfilters", ""));
|
||||
}
|
||||
@ -196,9 +196,9 @@ public class Map implements Comparable<Map>, Publishable{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Array<String> extraTags(){
|
||||
public Seq<String> extraTags(){
|
||||
Gamemode mode = Gamemode.attack.valid(this) ? Gamemode.attack : Gamemode.survival;
|
||||
return Array.with(mode.name());
|
||||
return Seq.with(mode.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -43,8 +43,8 @@ public class MapPreviewLoader extends TextureLoader{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Array<AssetDescriptor> getDependencies(String fileName, Fi file, TextureParameter parameter){
|
||||
return Array.with(new AssetDescriptor<>("contentcreate", Content.class));
|
||||
public Seq<AssetDescriptor> getDependencies(String fileName, Fi file, TextureParameter parameter){
|
||||
return Seq.with(new AssetDescriptor<>("contentcreate", Content.class));
|
||||
}
|
||||
|
||||
public static class MapPreviewParameter extends TextureParameter{
|
||||
|
@ -32,7 +32,7 @@ public class Maps{
|
||||
/** List of all built-in maps. Filenames only. */
|
||||
private static String[] defaultMapNames = {"maze", "fortress", "labyrinth", "islands", "tendrils", "caldera", "wasteland", "shattered", "fork", "triad", "veins", "glacier"};
|
||||
/** All maps stored in an ordered array. */
|
||||
private Array<Map> maps = new Array<>();
|
||||
private Seq<Map> maps = new Seq<>();
|
||||
/** Serializer for meta. */
|
||||
private Json json = new Json();
|
||||
|
||||
@ -61,17 +61,17 @@ public class Maps{
|
||||
}
|
||||
|
||||
/** Returns a list of all maps, including custom ones. */
|
||||
public Array<Map> all(){
|
||||
public Seq<Map> all(){
|
||||
return maps;
|
||||
}
|
||||
|
||||
/** Returns a list of only custom maps. */
|
||||
public Array<Map> customMaps(){
|
||||
public Seq<Map> customMaps(){
|
||||
return maps.select(m -> m.custom);
|
||||
}
|
||||
|
||||
/** Returns a list of only default maps. */
|
||||
public Array<Map> defaultMaps(){
|
||||
public Seq<Map> defaultMaps(){
|
||||
return maps.select(m -> !m.custom);
|
||||
}
|
||||
|
||||
@ -298,10 +298,10 @@ public class Maps{
|
||||
|
||||
/** Reads JSON of filters, returning a new default array if not found.*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Array<GenerateFilter> readFilters(String str){
|
||||
public Seq<GenerateFilter> readFilters(String str){
|
||||
if(str == null || str.isEmpty()){
|
||||
//create default filters list
|
||||
Array<GenerateFilter> filters = Array.with(
|
||||
Seq<GenerateFilter> filters = Seq.with(
|
||||
new ScatterFilter(){{
|
||||
flooronto = Blocks.stone;
|
||||
block = Blocks.rock;
|
||||
@ -329,7 +329,7 @@ public class Maps{
|
||||
return filters;
|
||||
}else{
|
||||
try{
|
||||
return JsonIO.read(Array.class, str);
|
||||
return JsonIO.read(Seq.class, str);
|
||||
}catch(Throwable e){
|
||||
e.printStackTrace();
|
||||
return readFilters("");
|
||||
@ -337,8 +337,8 @@ public class Maps{
|
||||
}
|
||||
}
|
||||
|
||||
public void addDefaultOres(Array<GenerateFilter> filters){
|
||||
Array<Block> ores = content.blocks().select(b -> b.isOverlay() && b.asFloor().oreDefault);
|
||||
public void addDefaultOres(Seq<GenerateFilter> filters){
|
||||
Seq<Block> ores = content.blocks().select(b -> b.isOverlay() && b.asFloor().oreDefault);
|
||||
for(Block block : ores){
|
||||
OreFilter filter = new OreFilter();
|
||||
filter.threshold = block.asFloor().oreThreshold;
|
||||
@ -348,7 +348,7 @@ public class Maps{
|
||||
}
|
||||
}
|
||||
|
||||
public String writeWaves(Array<SpawnGroup> groups){
|
||||
public String writeWaves(Seq<SpawnGroup> groups){
|
||||
if(groups == null) return "[]";
|
||||
|
||||
StringWriter buffer = new StringWriter();
|
||||
@ -364,8 +364,8 @@ public class Maps{
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
public Array<SpawnGroup> readWaves(String str){
|
||||
return str == null ? null : str.equals("[]") ? new Array<>() : Array.with(json.fromJson(SpawnGroup[].class, str));
|
||||
public Seq<SpawnGroup> readWaves(String str){
|
||||
return str == null ? null : str.equals("[]") ? new Seq<>() : Seq.with(json.fromJson(SpawnGroup[].class, str));
|
||||
}
|
||||
|
||||
public void loadPreviews(){
|
||||
@ -473,17 +473,17 @@ public class Maps{
|
||||
public enum ShuffleMode implements MapProvider{
|
||||
none(map -> null),
|
||||
all(prev -> {
|
||||
Array<Map> maps = Array.withArrays(Vars.maps.defaultMaps(), Vars.maps.customMaps());
|
||||
Seq<Map> maps = Seq.withArrays(Vars.maps.defaultMaps(), Vars.maps.customMaps());
|
||||
maps.shuffle();
|
||||
return maps.find(m -> m != prev || maps.size == 1);
|
||||
}),
|
||||
custom(prev -> {
|
||||
Array<Map> maps = Array.withArrays(Vars.maps.customMaps().isEmpty() ? Vars.maps.defaultMaps() : Vars.maps.customMaps());
|
||||
Seq<Map> maps = Seq.withArrays(Vars.maps.customMaps().isEmpty() ? Vars.maps.defaultMaps() : Vars.maps.customMaps());
|
||||
maps.shuffle();
|
||||
return maps.find(m -> m != prev || maps.size == 1);
|
||||
}),
|
||||
builtin(prev -> {
|
||||
Array<Map> maps = Array.withArrays(Vars.maps.defaultMaps());
|
||||
Seq<Map> maps = Seq.withArrays(Vars.maps.defaultMaps());
|
||||
maps.shuffle();
|
||||
return maps.find(m -> m != prev || maps.size == 1);
|
||||
});
|
||||
|
@ -21,7 +21,7 @@ public class CoreSpawnFilter extends GenerateFilter{
|
||||
|
||||
@Override
|
||||
public void apply(Tiles tiles, GenerateInput in){
|
||||
IntArray spawns = new IntArray();
|
||||
IntSeq spawns = new IntSeq();
|
||||
for(Tile tile : tiles){
|
||||
if(tile.team() == state.rules.defaultTeam && tile.block() instanceof CoreBlock && tile.isCenter()){
|
||||
spawns.add(tile.pos());
|
||||
|
@ -19,7 +19,7 @@ public class EnemySpawnFilter extends GenerateFilter{
|
||||
|
||||
@Override
|
||||
public void apply(Tiles tiles, GenerateInput in){
|
||||
IntArray spawns = new IntArray();
|
||||
IntSeq spawns = new IntSeq();
|
||||
for(Tile tile : tiles){
|
||||
if(tile.overlay() == Blocks.spawn){
|
||||
spawns.add(tile.pos());
|
||||
|
@ -11,7 +11,7 @@ import static mindustry.Vars.content;
|
||||
public class MedianFilter extends GenerateFilter{
|
||||
float radius = 2;
|
||||
float percentile = 0.5f;
|
||||
IntArray blocks = new IntArray(), floors = new IntArray();
|
||||
IntSeq blocks = new IntSeq(), floors = new IntSeq();
|
||||
|
||||
@Override
|
||||
public FilterOption[] options(){
|
||||
|
@ -12,7 +12,7 @@ public class OreMedianFilter extends GenerateFilter{
|
||||
public float radius = 2;
|
||||
public float percentile = 0.5f;
|
||||
|
||||
private IntArray blocks = new IntArray();
|
||||
private IntSeq blocks = new IntSeq();
|
||||
|
||||
@Override
|
||||
public FilterOption[] options(){
|
||||
|
@ -7,7 +7,7 @@ import mindustry.world.*;
|
||||
import mindustry.world.blocks.storage.*;
|
||||
|
||||
public class RandomItemFilter extends GenerateFilter{
|
||||
public Array<ItemStack> drops = new Array<>();
|
||||
public Seq<ItemStack> drops = new Seq<>();
|
||||
public float chance = 0.3f;
|
||||
|
||||
@Override
|
||||
|
@ -26,9 +26,9 @@ public class BaseGenerator{
|
||||
private Tiles tiles;
|
||||
private Team team;
|
||||
private ObjectMap<Item, OreBlock> ores = new ObjectMap<>();
|
||||
private Array<Tile> cores;
|
||||
private Seq<Tile> cores;
|
||||
|
||||
public void generate(Tiles tiles, Array<Tile> cores, Tile spawn, Team team, Sector sector){
|
||||
public void generate(Tiles tiles, Seq<Tile> cores, Tile spawn, Team team, Sector sector){
|
||||
this.tiles = tiles;
|
||||
this.team = team;
|
||||
this.cores = cores;
|
||||
@ -42,8 +42,8 @@ public class BaseGenerator{
|
||||
|
||||
float costBudget = 1000;
|
||||
|
||||
Array<Block> wallsSmall = content.blocks().select(b -> b instanceof Wall && b.size == 1);
|
||||
Array<Block> wallsLarge = content.blocks().select(b -> b instanceof Wall && b.size == 2);
|
||||
Seq<Block> wallsSmall = content.blocks().select(b -> b instanceof Wall && b.size == 1);
|
||||
Seq<Block> wallsLarge = content.blocks().select(b -> b instanceof Wall && b.size == 2);
|
||||
|
||||
float bracket = 0.1f;
|
||||
int wallAngle = 70; //180 for full coverage
|
||||
@ -69,7 +69,7 @@ public class BaseGenerator{
|
||||
if(!tile.block().alwaysReplace) return;
|
||||
|
||||
if((tile.drop() != null || (tile.floor().liquidDrop != null && Mathf.chance(nonResourceChance * 2))) && Mathf.chance(resourceChance)){
|
||||
Array<BasePart> parts = bases.forResource(tile.drop() != null ? tile.drop() : tile.floor().liquidDrop);
|
||||
Seq<BasePart> parts = bases.forResource(tile.drop() != null ? tile.drop() : tile.floor().liquidDrop);
|
||||
if(!parts.isEmpty()){
|
||||
tryPlace(parts.random(), tile.x, tile.y);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import mindustry.world.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public abstract class BasicGenerator implements WorldGenerator{
|
||||
protected static final ShortArray ints1 = new ShortArray(), ints2 = new ShortArray();
|
||||
protected static final ShortSeq ints1 = new ShortSeq(), ints2 = new ShortSeq();
|
||||
|
||||
protected Rand rand = new Rand();
|
||||
|
||||
@ -124,7 +124,7 @@ public abstract class BasicGenerator implements WorldGenerator{
|
||||
});
|
||||
}
|
||||
|
||||
public void ores(Array<Block> ores){
|
||||
public void ores(Seq<Block> ores){
|
||||
pass((x, y) -> {
|
||||
if(floor.asFloor().isLiquid) return;
|
||||
|
||||
@ -297,7 +297,7 @@ public abstract class BasicGenerator implements WorldGenerator{
|
||||
}
|
||||
}
|
||||
|
||||
public void brush(Array<Tile> path, int rad){
|
||||
public void brush(Seq<Tile> path, int rad){
|
||||
path.each(tile -> erase(tile.x, tile.y, rad));
|
||||
}
|
||||
|
||||
@ -313,7 +313,7 @@ public abstract class BasicGenerator implements WorldGenerator{
|
||||
}
|
||||
}
|
||||
|
||||
public Array<Tile> pathfind(int startX, int startY, int endX, int endY, TileHueristic th, DistanceHeuristic dh){
|
||||
public Seq<Tile> pathfind(int startX, int startY, int endX, int endY, TileHueristic th, DistanceHeuristic dh){
|
||||
return Astar.pathfind(startX, startY, endX, endY, th, dh, tile -> world.getDarkness(tile.x, tile.y) <= 1f);
|
||||
}
|
||||
|
||||
@ -331,7 +331,7 @@ public abstract class BasicGenerator implements WorldGenerator{
|
||||
}
|
||||
|
||||
public void inverseFloodFill(Tile start){
|
||||
IntArray arr = new IntArray();
|
||||
IntSeq arr = new IntSeq();
|
||||
arr.add(start.pos());
|
||||
while(!arr.isEmpty()){
|
||||
int i = arr.pop();
|
||||
|
@ -143,7 +143,7 @@ public class TODOPlanetGenerator extends PlanetGenerator{
|
||||
float constraint = 1.3f;
|
||||
float radius = width / 2f / Mathf.sqrt3;
|
||||
int rooms = rand.random(2, 5);
|
||||
Array<Room> array = new Array<>();
|
||||
Seq<Room> array = new Seq<>();
|
||||
|
||||
for(int i = 0; i < rooms; i++){
|
||||
Tmp.v1.trns(rand.random(360f), rand.random(radius / constraint));
|
||||
@ -156,7 +156,7 @@ public class TODOPlanetGenerator extends PlanetGenerator{
|
||||
|
||||
//check positions on the map to place the player spawn. this needs to be in the corner of the map
|
||||
Room spawn = null;
|
||||
Array<Room> enemies = new Array<>();
|
||||
Seq<Room> enemies = new Seq<>();
|
||||
int enemySpawns = rand.chance(0.3) ? 2 : 1;
|
||||
int offset = rand.nextInt(360);
|
||||
float length = width/2.55f - rand.random(13, 23);
|
||||
@ -212,7 +212,7 @@ public class TODOPlanetGenerator extends PlanetGenerator{
|
||||
|
||||
inverseFloodFill(tiles.getn(spawn.x, spawn.y));
|
||||
|
||||
Array<Block> ores = Array.with(Blocks.oreCopper, Blocks.oreLead);
|
||||
Seq<Block> ores = Seq.with(Blocks.oreCopper, Blocks.oreLead);
|
||||
float poles = Math.abs(sector.tile.v.y);
|
||||
float nmag = 0.5f;
|
||||
float scl = 1f;
|
||||
@ -230,7 +230,7 @@ public class TODOPlanetGenerator extends PlanetGenerator{
|
||||
ores.add(Blocks.oreThorium);
|
||||
}
|
||||
|
||||
FloatArray frequencies = new FloatArray();
|
||||
FloatSeq frequencies = new FloatSeq();
|
||||
for(int i = 0; i < ores.size; i++){
|
||||
frequencies.add(rand.random(-0.09f, 0.01f) - i * 0.01f);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import arc.files.*;
|
||||
import arc.func.*;
|
||||
import arc.graphics.*;
|
||||
import arc.mock.*;
|
||||
import arc.struct.Array;
|
||||
import arc.struct.Seq;
|
||||
import arc.struct.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import arc.util.*;
|
||||
@ -102,8 +102,8 @@ public class ContentParser{
|
||||
}};
|
||||
/** Stores things that need to be parsed fully, e.g. reading fields of content.
|
||||
* This is done to accomodate binding of content names first.*/
|
||||
private Array<Runnable> reads = new Array<>();
|
||||
private Array<Runnable> postreads = new Array<>();
|
||||
private Seq<Runnable> reads = new Seq<>();
|
||||
private Seq<Runnable> postreads = new Seq<>();
|
||||
private ObjectSet<Object> toBeParsed = new ObjectSet<>();
|
||||
private LoadedMod currentMod;
|
||||
private Content currentContent;
|
||||
@ -368,7 +368,7 @@ public class ContentParser{
|
||||
|
||||
private void init(){
|
||||
for(ContentType type : ContentType.all){
|
||||
Array<Content> arr = Vars.content.getBy(type);
|
||||
Seq<Content> arr = Vars.content.getBy(type);
|
||||
if(!arr.isEmpty()){
|
||||
Class<?> c = arr.first().getClass();
|
||||
//get base content class, skipping intermediates
|
||||
@ -459,7 +459,7 @@ public class ContentParser{
|
||||
}else if(t instanceof NullPointerException){
|
||||
builder.append(Strings.parseException(t, true));
|
||||
}else{
|
||||
Array<Throwable> causes = Strings.getCauses(t);
|
||||
Seq<Throwable> causes = Strings.getCauses(t);
|
||||
for(Throwable e : causes){
|
||||
builder.append("[accent][[").append(e.getClass().getSimpleName().replace("Exception", ""))
|
||||
.append("][] ")
|
||||
|
@ -33,13 +33,13 @@ public class Mods implements Loadable{
|
||||
private Json json = new Json();
|
||||
private @Nullable Scripts scripts;
|
||||
private ContentParser parser = new ContentParser();
|
||||
private ObjectMap<String, Array<Fi>> bundles = new ObjectMap<>();
|
||||
private ObjectMap<String, Seq<Fi>> bundles = new ObjectMap<>();
|
||||
private ObjectSet<String> specialFolders = ObjectSet.with("bundles", "sprites", "sprites-override");
|
||||
|
||||
private int totalSprites;
|
||||
private MultiPacker packer;
|
||||
|
||||
private Array<LoadedMod> mods = new Array<>();
|
||||
private Seq<LoadedMod> mods = new Seq<>();
|
||||
private ObjectMap<Class<?>, ModMeta> metas = new ObjectMap<>();
|
||||
private boolean requiresReload, createdAtlas;
|
||||
|
||||
@ -103,8 +103,8 @@ public class Mods implements Loadable{
|
||||
packer = new MultiPacker();
|
||||
|
||||
eachEnabled(mod -> {
|
||||
Array<Fi> sprites = mod.root.child("sprites").findAll(f -> f.extension().equals("png"));
|
||||
Array<Fi> overrides = mod.root.child("sprites-override").findAll(f -> f.extension().equals("png"));
|
||||
Seq<Fi> sprites = mod.root.child("sprites").findAll(f -> f.extension().equals("png"));
|
||||
Seq<Fi> overrides = mod.root.child("sprites-override").findAll(f -> f.extension().equals("png"));
|
||||
packSprites(sprites, mod, true);
|
||||
packSprites(overrides, mod, false);
|
||||
Log.debug("Packed @ images for mod '@'.", sprites.size + overrides.size, mod.meta.name);
|
||||
@ -127,7 +127,7 @@ public class Mods implements Loadable{
|
||||
}
|
||||
}
|
||||
|
||||
private void packSprites(Array<Fi> sprites, LoadedMod mod, boolean prefix){
|
||||
private void packSprites(Seq<Fi> sprites, LoadedMod mod, boolean prefix){
|
||||
for(Fi file : sprites){
|
||||
try(InputStream stream = file.read()){
|
||||
byte[] bytes = Streams.copyBytes(stream, Math.max((int)file.length(), 512));
|
||||
@ -171,7 +171,7 @@ public class Mods implements Loadable{
|
||||
packer.flush(filter, Core.atlas);
|
||||
|
||||
//generate new icons
|
||||
for(Array<Content> arr : content.getContentMap()){
|
||||
for(Seq<Content> arr : content.getContentMap()){
|
||||
arr.each(c -> {
|
||||
if(c instanceof UnlockableContent && c.minfo.mod != null){
|
||||
UnlockableContent u = (UnlockableContent)c;
|
||||
@ -305,16 +305,16 @@ public class Mods implements Loadable{
|
||||
}
|
||||
}
|
||||
|
||||
private void topoSort(LoadedMod mod, Array<LoadedMod> stack, ObjectSet<LoadedMod> visited){
|
||||
private void topoSort(LoadedMod mod, Seq<LoadedMod> stack, ObjectSet<LoadedMod> visited){
|
||||
visited.add(mod);
|
||||
mod.dependencies.each(m -> !visited.contains(m), m -> topoSort(m, stack, visited));
|
||||
stack.add(mod);
|
||||
}
|
||||
|
||||
/** @return mods ordered in the correct way needed for dependencies. */
|
||||
private Array<LoadedMod> orderedMods(){
|
||||
private Seq<LoadedMod> orderedMods(){
|
||||
ObjectSet<LoadedMod> visited = new ObjectSet<>();
|
||||
Array<LoadedMod> result = new Array<>();
|
||||
Seq<LoadedMod> result = new Seq<>();
|
||||
eachEnabled(mod -> {
|
||||
if(!visited.contains(mod)){
|
||||
topoSort(mod, result, visited);
|
||||
@ -346,7 +346,7 @@ public class Mods implements Loadable{
|
||||
for(Fi file : folder.list()){
|
||||
if(file.name().startsWith("bundle") && file.extension().equals("properties")){
|
||||
String name = file.nameWithoutExtension();
|
||||
bundles.get(name, Array::new).add(file);
|
||||
bundles.get(name, Seq::new).add(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -357,7 +357,7 @@ public class Mods implements Loadable{
|
||||
while(bundle != null){
|
||||
String str = bundle.getLocale().toString();
|
||||
String locale = "bundle" + (str.isEmpty() ? "" : "_" + str);
|
||||
for(Fi file : bundles.get(locale, Array::new)){
|
||||
for(Fi file : bundles.get(locale, Seq::new)){
|
||||
try{
|
||||
PropertiesUtils.load(bundle.getProperties(), file.reader());
|
||||
}catch(Throwable e){
|
||||
@ -469,7 +469,7 @@ public class Mods implements Loadable{
|
||||
if(mod.root.child("scripts").exists()){
|
||||
content.setCurrentMod(mod);
|
||||
//if there's only one script file, use it (for backwards compatibility); if there isn't, use "main.js"
|
||||
Array<Fi> allScripts = mod.root.child("scripts").findAll(f -> f.extEquals("js"));
|
||||
Seq<Fi> allScripts = mod.root.child("scripts").findAll(f -> f.extEquals("js"));
|
||||
Fi main = allScripts.size == 1 ? allScripts.first() : mod.root.child("scripts").child("main.js");
|
||||
if(main.exists() && !main.isDirectory()){
|
||||
try{
|
||||
@ -519,7 +519,7 @@ public class Mods implements Loadable{
|
||||
}
|
||||
}
|
||||
|
||||
Array<LoadRun> runs = new Array<>();
|
||||
Seq<LoadRun> runs = new Seq<>();
|
||||
|
||||
for(LoadedMod mod : orderedMods()){
|
||||
if(mod.root.child("content").exists()){
|
||||
@ -562,7 +562,7 @@ public class Mods implements Loadable{
|
||||
}
|
||||
|
||||
/** @return a list of mods and versions, in the format name:version. */
|
||||
public Array<String> getModStrings(){
|
||||
public Seq<String> getModStrings(){
|
||||
return mods.select(l -> !l.meta.hidden && l.enabled()).map(l -> l.name + ":" + l.meta.version);
|
||||
}
|
||||
|
||||
@ -579,9 +579,9 @@ public class Mods implements Loadable{
|
||||
|
||||
/** @return the mods that the client is missing.
|
||||
* The inputted array is changed to contain the extra mods that the client has but the server doesn't.*/
|
||||
public Array<String> getIncompatibility(Array<String> out){
|
||||
Array<String> mods = getModStrings();
|
||||
Array<String> result = mods.copy();
|
||||
public Seq<String> getIncompatibility(Seq<String> out){
|
||||
Seq<String> mods = getModStrings();
|
||||
Seq<String> result = mods.copy();
|
||||
for(String mod : mods){
|
||||
if(out.remove(mod)){
|
||||
result.remove(mod);
|
||||
@ -590,7 +590,7 @@ public class Mods implements Loadable{
|
||||
return result;
|
||||
}
|
||||
|
||||
public Array<LoadedMod> list(){
|
||||
public Seq<LoadedMod> list(){
|
||||
return mods;
|
||||
}
|
||||
|
||||
@ -681,11 +681,11 @@ public class Mods implements Loadable{
|
||||
/** This mod's metadata. */
|
||||
public final ModMeta meta;
|
||||
/** This mod's dependencies as already-loaded mods. */
|
||||
public Array<LoadedMod> dependencies = new Array<>();
|
||||
public Seq<LoadedMod> dependencies = new Seq<>();
|
||||
/** All missing dependencies of this mod as strings. */
|
||||
public Array<String> missingDependencies = new Array<>();
|
||||
public Seq<String> missingDependencies = new Seq<>();
|
||||
/** Script files to run. */
|
||||
public Array<Fi> scripts = new Array<>();
|
||||
public Seq<Fi> scripts = new Seq<>();
|
||||
/** Content with intialization code. */
|
||||
public ObjectSet<Content> erroredContent = new ObjectSet<>();
|
||||
/** Current state of this mod. */
|
||||
@ -805,7 +805,7 @@ public class Mods implements Loadable{
|
||||
/** Plugin metadata information.*/
|
||||
public static class ModMeta{
|
||||
public String name, displayName, author, description, version, main, minGameVersion;
|
||||
public Array<String> dependencies = Array.with();
|
||||
public Seq<String> dependencies = Seq.with();
|
||||
/** Hidden mods are only server-side or client-side, and do not support adding new content. */
|
||||
public boolean hidden;
|
||||
|
||||
|
@ -18,15 +18,15 @@ import java.util.regex.*;
|
||||
|
||||
public class Scripts implements Disposable{
|
||||
private final static Object[] emptyObjects = {};
|
||||
private final Array<String> blacklist = Array.with("net", "files", "reflect", "javax", "rhino", "file", "channels", "jdk",
|
||||
private final Seq<String> blacklist = Seq.with("net", "files", "reflect", "javax", "rhino", "file", "channels", "jdk",
|
||||
"runtime", "util.os", "rmi", "security", "org.", "sun.", "beans", "sql", "http", "exec", "compiler", "process", "system",
|
||||
".awt", "socket", "classloader", "oracle", "invoke", "arc.events", "java.util.function", "java.util.stream");
|
||||
private final Array<String> whitelist = Array.with("mindustry.net", "netserver", "netclient", "com.sun.proxy.$proxy", "mindustry.gen.");
|
||||
private final Seq<String> whitelist = Seq.with("mindustry.net", "netserver", "netclient", "com.sun.proxy.$proxy", "mindustry.gen.");
|
||||
private final Context context;
|
||||
private Scriptable scope;
|
||||
private boolean errored;
|
||||
private LoadedMod currentMod = null;
|
||||
private Array<EventHandle> events = new Array<>();
|
||||
private Seq<EventHandle> events = new Seq<>();
|
||||
|
||||
public Scripts(){
|
||||
Time.mark();
|
||||
|
@ -20,11 +20,11 @@ import static mindustry.game.EventType.*;
|
||||
public class Administration{
|
||||
/** All player info. Maps UUIDs to info. This persists throughout restarts. */
|
||||
private ObjectMap<String, PlayerInfo> playerInfo = new ObjectMap<>();
|
||||
private Array<String> bannedIPs = new Array<>();
|
||||
private Array<String> whitelist = new Array<>();
|
||||
private Array<ChatFilter> chatFilters = new Array<>();
|
||||
private Array<ActionFilter> actionFilters = new Array<>();
|
||||
private Array<String> subnetBans = new Array<>();
|
||||
private Seq<String> bannedIPs = new Seq<>();
|
||||
private Seq<String> whitelist = new Seq<>();
|
||||
private Seq<ChatFilter> chatFilters = new Seq<>();
|
||||
private Seq<ActionFilter> actionFilters = new Seq<>();
|
||||
private Seq<String> subnetBans = new Seq<>();
|
||||
private IntIntMap lastPlaced = new IntIntMap();
|
||||
|
||||
public Administration(){
|
||||
@ -97,7 +97,7 @@ public class Administration{
|
||||
});
|
||||
}
|
||||
|
||||
public Array<String> getSubnetBans(){
|
||||
public Seq<String> getSubnetBans(){
|
||||
return subnetBans;
|
||||
}
|
||||
|
||||
@ -256,8 +256,8 @@ public class Administration{
|
||||
/**
|
||||
* Returns list of all players with admin status
|
||||
*/
|
||||
public Array<PlayerInfo> getAdmins(){
|
||||
Array<PlayerInfo> result = new Array<>();
|
||||
public Seq<PlayerInfo> getAdmins(){
|
||||
Seq<PlayerInfo> result = new Seq<>();
|
||||
for(PlayerInfo info : playerInfo.values()){
|
||||
if(info.admin){
|
||||
result.add(info);
|
||||
@ -269,8 +269,8 @@ public class Administration{
|
||||
/**
|
||||
* Returns list of all players which are banned
|
||||
*/
|
||||
public Array<PlayerInfo> getBanned(){
|
||||
Array<PlayerInfo> result = new Array<>();
|
||||
public Seq<PlayerInfo> getBanned(){
|
||||
Seq<PlayerInfo> result = new Seq<>();
|
||||
for(PlayerInfo info : playerInfo.values()){
|
||||
if(info.banned){
|
||||
result.add(info);
|
||||
@ -282,7 +282,7 @@ public class Administration{
|
||||
/**
|
||||
* Returns all banned IPs. This does not include the IPs of ID-banned players.
|
||||
*/
|
||||
public Array<String> getBannedIPs(){
|
||||
public Seq<String> getBannedIPs(){
|
||||
return bannedIPs;
|
||||
}
|
||||
|
||||
@ -384,8 +384,8 @@ public class Administration{
|
||||
return result;
|
||||
}
|
||||
|
||||
public Array<PlayerInfo> findByIPs(String ip){
|
||||
Array<PlayerInfo> result = new Array<>();
|
||||
public Seq<PlayerInfo> findByIPs(String ip){
|
||||
Seq<PlayerInfo> result = new Seq<>();
|
||||
|
||||
for(PlayerInfo info : playerInfo.values()){
|
||||
if(info.ips.contains(ip, false)){
|
||||
@ -413,7 +413,7 @@ public class Administration{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Array<PlayerInfo> getWhitelisted(){
|
||||
public Seq<PlayerInfo> getWhitelisted(){
|
||||
return playerInfo.values().toArray().select(p -> isWhitelisted(p.id, p.adminUsid));
|
||||
}
|
||||
|
||||
@ -440,9 +440,9 @@ public class Administration{
|
||||
if(!loadLegacy()){
|
||||
//load default data
|
||||
playerInfo = Core.settings.getJson("player-data", ObjectMap.class, ObjectMap::new);
|
||||
bannedIPs = Core.settings.getJson("ip-bans", Array.class, Array::new);
|
||||
whitelist = Core.settings.getJson("whitelist-ids", Array.class, Array::new);
|
||||
subnetBans = Core.settings.getJson("banned-subnets", Array.class, Array::new);
|
||||
bannedIPs = Core.settings.getJson("ip-bans", Seq.class, Seq::new);
|
||||
whitelist = Core.settings.getJson("whitelist-ids", Seq.class, Seq::new);
|
||||
subnetBans = Core.settings.getJson("banned-subnets", Seq.class, Seq::new);
|
||||
}else{
|
||||
//save over loaded legacy data
|
||||
save();
|
||||
@ -631,8 +631,8 @@ public class Administration{
|
||||
public static class PlayerInfo{
|
||||
public String id;
|
||||
public String lastName = "<unknown>", lastIP = "<unknown>";
|
||||
public Array<String> ips = new Array<>();
|
||||
public Array<String> names = new Array<>();
|
||||
public Seq<String> ips = new Seq<>();
|
||||
public Seq<String> names = new Seq<>();
|
||||
public String adminUsid;
|
||||
public int timesKicked;
|
||||
public int timesJoined;
|
||||
|
@ -198,7 +198,7 @@ public class ArcNetProvider implements NetProvider{
|
||||
|
||||
@Override
|
||||
public void discoverServers(Cons<Host> callback, Runnable done){
|
||||
Array<InetAddress> foundAddresses = new Array<>();
|
||||
Seq<InetAddress> foundAddresses = new Seq<>();
|
||||
client.discoverHosts(port, multicastGroup, multicastPort, 3000, packet -> {
|
||||
Core.app.post(() -> {
|
||||
try{
|
||||
|
@ -23,7 +23,7 @@ public class Net{
|
||||
private boolean clientLoaded;
|
||||
private @Nullable StreamBuilder currentStream;
|
||||
|
||||
private final Array<Object> packetQueue = new Array<>();
|
||||
private final Seq<Object> packetQueue = new Seq<>();
|
||||
private final ObjectMap<Class<?>, Cons> clientListeners = new ObjectMap<>();
|
||||
private final ObjectMap<Class<?>, Cons2<NetConnection, Object>> serverListeners = new ObjectMap<>();
|
||||
private final IntMap<StreamBuilder> streams = new IntMap<>();
|
||||
|
@ -27,7 +27,7 @@ public abstract class NetConnection{
|
||||
/** Timestamp of last recieved snapshot. */
|
||||
public long lastRecievedClientTime;
|
||||
/** Build requests that have been recently rejected. This is cleared every snapshot. */
|
||||
public Array<BuildRequest> rejectedRequests = new Array<>();
|
||||
public Seq<BuildRequest> rejectedRequests = new Seq<>();
|
||||
|
||||
public boolean hasConnected, hasBegunConnecting, hasDisconnected;
|
||||
public float viewWidth, viewHeight, viewX, viewY;
|
||||
|
@ -159,7 +159,7 @@ public class Packets{
|
||||
public static class ConnectPacket implements Packet{
|
||||
public int version;
|
||||
public String versionType;
|
||||
public Array<String> mods;
|
||||
public Seq<String> mods;
|
||||
public String name, uuid, usid;
|
||||
public boolean mobile;
|
||||
public int color;
|
||||
@ -196,7 +196,7 @@ public class Packets{
|
||||
mobile = buffer.get() == 1;
|
||||
color = buffer.getInt();
|
||||
int totalMods = buffer.get();
|
||||
mods = new Array<>(totalMods);
|
||||
mods = new Seq<>(totalMods);
|
||||
for(int i = 0; i < totalMods; i++){
|
||||
mods.add(TypeIO.readString(buffer));
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class Item extends UnlockableContent{
|
||||
}
|
||||
|
||||
/** Allocates a new array containing all items that generate ores. */
|
||||
public static Array<Item> getAllOres(){
|
||||
public static Seq<Item> getAllOres(){
|
||||
return content.blocks().select(b -> b instanceof OreBlock).map(b -> ((Floor)b).itemDrop);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package mindustry.type;
|
||||
|
||||
import arc.struct.Array;
|
||||
import arc.struct.Seq;
|
||||
import mindustry.content.Items;
|
||||
|
||||
public class ItemStack implements Comparable<ItemStack>{
|
||||
@ -51,8 +51,8 @@ public class ItemStack implements Comparable<ItemStack>{
|
||||
return stacks;
|
||||
}
|
||||
|
||||
public static Array<ItemStack> list(Object... items){
|
||||
Array<ItemStack> stacks = new Array<>(items.length / 2);
|
||||
public static Seq<ItemStack> list(Object... items){
|
||||
Seq<ItemStack> stacks = new Seq<>(items.length / 2);
|
||||
for(int i = 0; i < items.length; i += 2){
|
||||
stacks.add(new ItemStack((Item)items[i], ((Number)items[i + 1]).intValue()));
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public class Planet extends UnlockableContent{
|
||||
/** Generator that will make the planet. Can be null for planets that don't need to be landed on. */
|
||||
public @Nullable PlanetGenerator generator;
|
||||
/** Array of sectors; directly maps to tiles in the grid. */
|
||||
public @NonNull Array<Sector> sectors;
|
||||
public @NonNull Seq<Sector> sectors;
|
||||
/** Radius of this planet's sphere. Does not take into account sattelites. */
|
||||
public float radius;
|
||||
/** Orbital radius around the sun. Do not change unless you know exactly what you are doing.*/
|
||||
@ -62,9 +62,9 @@ public class Planet extends UnlockableContent{
|
||||
/** The root parent of the whole solar system this planet is in. */
|
||||
public @NonNull Planet solarSystem;
|
||||
/** All planets orbiting this one, in ascending order of radius. */
|
||||
public Array<Planet> children = new Array<>();
|
||||
public Seq<Planet> children = new Seq<>();
|
||||
/** Sattelites orbiting this planet. */
|
||||
public Array<Satellite> satellites = new Array<>();
|
||||
public Seq<Satellite> satellites = new Seq<>();
|
||||
/** Loads the mesh. Clientside only. Defaults to a boring sphere mesh. */
|
||||
protected Prov<PlanetMesh> meshLoader = () -> new ShaderSphereMesh(this, Shaders.unlit, 2);
|
||||
|
||||
@ -77,7 +77,7 @@ public class Planet extends UnlockableContent{
|
||||
if(sectorSize > 0){
|
||||
grid = PlanetGrid.create(sectorSize);
|
||||
|
||||
sectors = new Array<>(grid.tiles.length);
|
||||
sectors = new Seq<>(grid.tiles.length);
|
||||
for(int i = 0; i < grid.tiles.length; i++){
|
||||
sectors.add(new Sector(this, grid.tiles[i], new SectorData()));
|
||||
}
|
||||
@ -103,7 +103,7 @@ public class Planet extends UnlockableContent{
|
||||
sector.generate();
|
||||
}
|
||||
}else{
|
||||
sectors = new Array<>();
|
||||
sectors = new Seq<>();
|
||||
}
|
||||
|
||||
//total radius is initially just the radius
|
||||
|
@ -24,8 +24,8 @@ public interface Publishable{
|
||||
/** @return a preview file PNG. */
|
||||
Fi createSteamPreview(String id);
|
||||
/** @return any extra tags to add to this item.*/
|
||||
default Array<String> extraTags(){
|
||||
return new Array<>(0);
|
||||
default Seq<String> extraTags(){
|
||||
return new Seq<>(0);
|
||||
}
|
||||
/** @return whether this item is or was once on the workshop.*/
|
||||
default boolean hasSteamID(){
|
||||
|
@ -18,17 +18,17 @@ public class SectorPreset extends UnlockableContent{
|
||||
public @NonNull FileMapGenerator generator;
|
||||
public @NonNull Planet planet;
|
||||
public @NonNull Sector sector;
|
||||
public Array<Objective> requirements = new Array<>();
|
||||
public Seq<Objective> requirements = new Seq<>();
|
||||
|
||||
public Cons<Rules> rules = rules -> {};
|
||||
public int conditionWave = Integer.MAX_VALUE;
|
||||
public int launchPeriod = 10;
|
||||
public Schematic loadout = Loadouts.basicShard;
|
||||
|
||||
protected Array<ItemStack> baseLaunchCost = new Array<>();
|
||||
protected Array<ItemStack> startingItems = new Array<>();
|
||||
protected Array<ItemStack> launchCost;
|
||||
protected Array<ItemStack> defaultStartingItems = new Array<>();
|
||||
protected Seq<ItemStack> baseLaunchCost = new Seq<>();
|
||||
protected Seq<ItemStack> startingItems = new Seq<>();
|
||||
protected Seq<ItemStack> launchCost;
|
||||
protected Seq<ItemStack> defaultStartingItems = new Seq<>();
|
||||
|
||||
public SectorPreset(String name, Planet planet, int sector){
|
||||
super(name);
|
||||
@ -51,14 +51,14 @@ public class SectorPreset extends UnlockableContent{
|
||||
return data.isUnlocked(this) || !requirements.contains(r -> !r.complete());
|
||||
}
|
||||
|
||||
public Array<ItemStack> getLaunchCost(){
|
||||
public Seq<ItemStack> getLaunchCost(){
|
||||
if(launchCost == null){
|
||||
updateLaunchCost();
|
||||
}
|
||||
return launchCost;
|
||||
}
|
||||
|
||||
public Array<ItemStack> getStartingItems(){
|
||||
public Seq<ItemStack> getStartingItems(){
|
||||
return startingItems;
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ public class SectorPreset extends UnlockableContent{
|
||||
}
|
||||
|
||||
public void updateObjectives(Runnable closure){
|
||||
Array<SectorObjective> incomplete = content.sectors()
|
||||
Seq<SectorObjective> incomplete = content.sectors()
|
||||
.flatMap(z -> z.requirements)
|
||||
.filter(o -> o.zone() == this && !o.complete()).as();
|
||||
|
||||
@ -112,7 +112,7 @@ public class SectorPreset extends UnlockableContent{
|
||||
}
|
||||
|
||||
public void updateLaunchCost(){
|
||||
Array<ItemStack> stacks = new Array<>();
|
||||
Seq<ItemStack> stacks = new Seq<>();
|
||||
|
||||
Cons<ItemStack> adder = stack -> {
|
||||
for(ItemStack other : stacks){
|
||||
|
@ -66,7 +66,7 @@ public class UnitType extends UnlockableContent{
|
||||
public ObjectSet<StatusEffect> immunities = new ObjectSet<>();
|
||||
public Sound deathSound = Sounds.bang;
|
||||
|
||||
public Array<Weapon> weapons = new Array<>();
|
||||
public Seq<Weapon> weapons = new Seq<>();
|
||||
public TextureRegion baseRegion, legRegion, region, shadowRegion, cellRegion,
|
||||
occlusionRegion, jointRegion, footRegion, legBaseRegion, baseJointRegion;
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class ContentDisplay{
|
||||
BlockStats stats = block.stats;
|
||||
|
||||
for(StatCategory cat : stats.toMap().keys()){
|
||||
OrderedMap<BlockStat, Array<StatValue>> map = stats.toMap().get(cat);
|
||||
OrderedMap<BlockStat, Seq<StatValue>> map = stats.toMap().get(cat);
|
||||
|
||||
if(map.size == 0) continue;
|
||||
|
||||
@ -49,7 +49,7 @@ public class ContentDisplay{
|
||||
table.table(inset -> {
|
||||
inset.left();
|
||||
inset.add("[lightgray]" + stat.localized() + ":[] ").left();
|
||||
Array<StatValue> arr = map.get(stat);
|
||||
Seq<StatValue> arr = map.get(stat);
|
||||
for(StatValue value : arr){
|
||||
value.display(inset);
|
||||
inset.add().size(10f);
|
||||
|
@ -67,7 +67,7 @@ public class Fonts{
|
||||
}
|
||||
|
||||
public static void loadContentIcons(){
|
||||
Array<BitmapFont> fonts = Array.with(Fonts.chat, Fonts.def, Fonts.outline);
|
||||
Seq<BitmapFont> fonts = Seq.with(Fonts.chat, Fonts.def, Fonts.outline);
|
||||
Texture uitex = Core.atlas.find("logo").getTexture();
|
||||
int size = (int)(Fonts.def.getData().lineHeight/Fonts.def.getData().scaleY);
|
||||
|
||||
@ -156,7 +156,7 @@ public class Fonts{
|
||||
|
||||
Page page = UI.packer.getPages().first();
|
||||
|
||||
Array<AtlasRegion> regions = atlas.getRegions().select(t -> t.getTexture() == texture);
|
||||
Seq<AtlasRegion> regions = atlas.getRegions().select(t -> t.getTexture() == texture);
|
||||
for(AtlasRegion region : regions){
|
||||
//get new pack rect
|
||||
page.setDirty(false);
|
||||
|
@ -1,11 +1,11 @@
|
||||
package mindustry.ui;
|
||||
|
||||
import arc.struct.Array;
|
||||
import arc.struct.Seq;
|
||||
import arc.scene.ui.layout.Stack;
|
||||
import arc.util.Time;
|
||||
|
||||
public class MultiReqImage extends Stack{
|
||||
private Array<ReqImage> displays = new Array<>();
|
||||
private Seq<ReqImage> displays = new Seq<>();
|
||||
private float time;
|
||||
|
||||
public void add(ReqImage display){
|
||||
|
@ -15,14 +15,14 @@ import mindustry.ui.Links.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class AboutDialog extends BaseDialog{
|
||||
private Array<String> contributors = new Array<>();
|
||||
private Seq<String> contributors = new Seq<>();
|
||||
private static ObjectSet<String> bannedItems = ObjectSet.with("google-play", "itch.io", "dev-builds", "f-droid");
|
||||
|
||||
public AboutDialog(){
|
||||
super("$about.button");
|
||||
|
||||
shown(() -> {
|
||||
contributors = Array.with(Core.files.internal("contributors").readString("UTF-8").split("\n"));
|
||||
contributors = Seq.with(Core.files.internal("contributors").readString("UTF-8").split("\n"));
|
||||
Core.app.post(this::setup);
|
||||
});
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user