mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-25 10:25:42 +07:00
Cleanup
This commit is contained in:
parent
843a8c3e56
commit
7ff2e98420
@ -23,6 +23,7 @@ mindustry.world.blocks.campaign.CoreLauncher.LaunchCoreComp=13
|
||||
mindustry.world.blocks.campaign.LaunchPad.LaunchPayloadComp=14
|
||||
oculon=15
|
||||
phantom=16
|
||||
spirit=27
|
||||
tau=17
|
||||
trident=18
|
||||
vanguard=19
|
||||
|
@ -86,11 +86,6 @@ public class Pathfinder implements Runnable{
|
||||
queue.clear();
|
||||
}
|
||||
|
||||
//public int debugValue(Team team, int x, int y){
|
||||
// if(pathMap[team.id][FlagTarget.enemyCores.ordinal()] == null) return 0;
|
||||
// return pathMap[team.id][FlagTarget.enemyCores.ordinal()].weights[x][y];
|
||||
//}
|
||||
|
||||
/** Update a tile in the internal pathfinding grid.
|
||||
* Causes a complete pathfinding reclaculation. Main thread only. */
|
||||
public void updateTile(Tile tile){
|
||||
|
@ -22,8 +22,8 @@ import static mindustry.Vars.mods;
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class ContentLoader{
|
||||
private ObjectMap<String, MappableContent>[] contentNameMap = new ObjectMap[ContentType.values().length];
|
||||
private Seq<Content>[] contentMap = new Seq[ContentType.values().length];
|
||||
private ObjectMap<String, MappableContent>[] contentNameMap = new ObjectMap[ContentType.all.length];
|
||||
private Seq<Content>[] contentMap = new Seq[ContentType.all.length];
|
||||
private MappableContent[][] temporaryMapper;
|
||||
private @Nullable LoadedMod currentMod;
|
||||
private @Nullable Content lastAdded;
|
||||
@ -48,11 +48,11 @@ public class ContentLoader{
|
||||
|
||||
/** Clears all initialized content.*/
|
||||
public void clear(){
|
||||
contentNameMap = new ObjectMap[ContentType.values().length];
|
||||
contentMap = new Seq[ContentType.values().length];
|
||||
contentNameMap = new ObjectMap[ContentType.all.length];
|
||||
contentMap = new Seq[ContentType.all.length];
|
||||
initialization = new ObjectSet<>();
|
||||
|
||||
for(ContentType type : ContentType.values()){
|
||||
for(ContentType type : ContentType.all){
|
||||
contentMap[type.ordinal()] = new Seq<>();
|
||||
contentNameMap[type.ordinal()] = new ObjectMap<>();
|
||||
}
|
||||
@ -87,9 +87,9 @@ public class ContentLoader{
|
||||
|
||||
Log.debug("--- CONTENT INFO ---");
|
||||
for(int k = 0; k < contentMap.length; k++){
|
||||
Log.debug("[@]: loaded @", ContentType.values()[k].name(), contentMap[k].size);
|
||||
Log.debug("[@]: loaded @", ContentType.all[k].name(), contentMap[k].size);
|
||||
}
|
||||
Log.debug("Total content loaded: @", Seq.with(ContentType.values()).mapInt(c -> contentMap[c.ordinal()].size).sum());
|
||||
Log.debug("Total content loaded: @", Seq.with(ContentType.all).mapInt(c -> contentMap[c.ordinal()].size).sum());
|
||||
Log.debug("-------------------");
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ public class ContentLoader{
|
||||
private void initialize(Cons<Content> callable){
|
||||
if(initialization.contains(callable)) return;
|
||||
|
||||
for(ContentType type : ContentType.values()){
|
||||
for(ContentType type : ContentType.all){
|
||||
for(Content content : contentMap[type.ordinal()]){
|
||||
try{
|
||||
callable.get(content);
|
||||
|
@ -72,11 +72,11 @@ abstract class BuilderComp implements Unitc{
|
||||
|
||||
BuildPlan current = buildPlan();
|
||||
|
||||
if(dst(current.tile()) > finalPlaceDst) return;
|
||||
if(!within(current.tile(), finalPlaceDst)) return;
|
||||
|
||||
Tile tile = world.tile(current.x, current.y);
|
||||
|
||||
if(dst(tile) <= finalPlaceDst){
|
||||
if(!within(tile, finalPlaceDst)){
|
||||
rotation = Mathf.slerpDelta(rotation, angleTo(tile), 0.4f);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc, Unitc{
|
||||
public void update(){
|
||||
Building core = closestCore();
|
||||
|
||||
if(core != null && mineTile != null && mineTile.drop() != null && !acceptsItem(mineTile.drop()) && dst(core) < mineTransferRange){
|
||||
if(core != null && mineTile != null && mineTile.drop() != null && !acceptsItem(mineTile.drop()) && within(core, mineTransferRange)){
|
||||
int accepted = core.acceptStack(item(), stack().amount, this);
|
||||
if(accepted > 0){
|
||||
Call.transferItemTo(item(), accepted,
|
||||
@ -63,7 +63,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc, Unitc{
|
||||
if(mineTimer >= 50f + item.hardness*10f){
|
||||
mineTimer = 0;
|
||||
|
||||
if(dst(core) < mineTransferRange && core.acceptStack(item, 1, this) == 1 && offloadImmediately()){
|
||||
if(within(core, mineTransferRange) && core.acceptStack(item, 1, this) == 1 && offloadImmediately()){
|
||||
Call.transferItemTo(item, 1,
|
||||
mineTile.worldx() + Mathf.range(tilesize / 2f),
|
||||
mineTile.worldy() + Mathf.range(tilesize / 2f), core.tile());
|
||||
|
@ -12,29 +12,28 @@ public class IndexedRenderer implements Disposable{
|
||||
private final static int vsize = 5;
|
||||
|
||||
private Shader program = new Shader(
|
||||
Strings.join("\n",
|
||||
"attribute vec4 " + Shader.positionAttribute + ";",
|
||||
"attribute vec4 " + Shader.colorAttribute + ";",
|
||||
"attribute vec2 " + Shader.texcoordAttribute + "0;",
|
||||
"uniform mat4 u_projTrans;",
|
||||
"varying vec4 v_color;",
|
||||
"varying vec2 v_texCoords;",
|
||||
"",
|
||||
"void main(){",
|
||||
" v_color = " + Shader.colorAttribute + ";",
|
||||
" v_color.a = v_color.a * (255.0/254.0);",
|
||||
" v_texCoords = " + Shader.texcoordAttribute + "0;",
|
||||
" gl_Position = u_projTrans * " + Shader.positionAttribute + ";",
|
||||
"}"),
|
||||
Strings.join("\n",
|
||||
"varying lowp vec4 v_color;",
|
||||
"varying vec2 v_texCoords;",
|
||||
"uniform sampler2D u_texture;",
|
||||
"",
|
||||
"void main(){",
|
||||
" gl_FragColor = v_color * texture2D(u_texture, v_texCoords);",
|
||||
"attribute vec4 a_position;\n" +
|
||||
"attribute vec4 a_color;\n" +
|
||||
"attribute vec2 a_texCoord0;\n" +
|
||||
"uniform mat4 u_projTrans;\n" +
|
||||
"varying vec4 v_color;\n" +
|
||||
"varying vec2 v_texCoords;\n" +
|
||||
|
||||
"void main(){\n" +
|
||||
" v_color = a_color;\n" +
|
||||
" v_color.a = v_color.a * (255.0/254.0);\n" +
|
||||
" v_texCoords = a_texCoord0;\n" +
|
||||
" gl_Position = u_projTrans * a_position;\n" +
|
||||
"}",
|
||||
|
||||
"varying lowp vec4 v_color;\n" +
|
||||
"varying vec2 v_texCoords;\n" +
|
||||
"uniform sampler2D u_texture;\n" +
|
||||
|
||||
"void main(){\n" +
|
||||
" gl_FragColor = v_color * texture2D(u_texture, v_texCoords);\n" +
|
||||
"}"
|
||||
));
|
||||
);
|
||||
private Mesh mesh;
|
||||
private float[] tmpVerts = new float[vsize * 6];
|
||||
private float[] vertices;
|
||||
|
@ -327,10 +327,10 @@ public abstract class SaveVersion extends SaveFileReader{
|
||||
public void readContentHeader(DataInput stream) throws IOException{
|
||||
byte mapped = stream.readByte();
|
||||
|
||||
MappableContent[][] map = new MappableContent[ContentType.values().length][0];
|
||||
MappableContent[][] map = new MappableContent[ContentType.all.length][0];
|
||||
|
||||
for(int i = 0; i < mapped; i++){
|
||||
ContentType type = ContentType.values()[stream.readByte()];
|
||||
ContentType type = ContentType.all[stream.readByte()];
|
||||
short total = stream.readShort();
|
||||
map[type.ordinal()] = new MappableContent[total];
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class DatabaseDialog extends BaseDialog{
|
||||
Seq<Content>[] allContent = Vars.content.getContentMap();
|
||||
|
||||
for(int j = 0; j < allContent.length; j++){
|
||||
ContentType type = ContentType.values()[j];
|
||||
ContentType type = ContentType.all[j];
|
||||
|
||||
Seq<Content> array = allContent[j].select(c -> c instanceof UnlockableContent && !((UnlockableContent)c).isHidden());
|
||||
if(array.size == 0) continue;
|
||||
|
@ -360,8 +360,8 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of all tiles linked to this multiblock, or just itself if it's not a multiblock.
|
||||
* This array contains all linked tiles, including this tile itself.
|
||||
* Iterates through the list of all tiles linked to this multiblock, or just itself if it's not a multiblock.
|
||||
* The result contains all linked tiles, including this tile itself.
|
||||
*/
|
||||
public void getLinkedTiles(Cons<Tile> cons){
|
||||
if(block.isMultiblock()){
|
||||
@ -391,7 +391,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
||||
|
||||
/**
|
||||
* Returns the list of all tiles linked to this multiblock if it were this block.
|
||||
* This array contains all linked tiles, including this tile itself.
|
||||
* The result contains all linked tiles, including this tile itself.
|
||||
*/
|
||||
public Seq<Tile> getLinkedTilesAs(Block block, Seq<Tile> tmpArray){
|
||||
tmpArray.clear();
|
||||
|
@ -32,7 +32,7 @@ public class ForceProjector extends Block{
|
||||
public @Load("@-top") TextureRegion topRegion;
|
||||
|
||||
private static ForceProjectorEntity paramEntity;
|
||||
private static Cons<Shielderc> shieldConsumer = trait -> {
|
||||
private static final Cons<Shielderc> shieldConsumer = trait -> {
|
||||
if(trait.team() != paramEntity.team() && Intersector.isInsideHexagon(paramEntity.x, paramEntity.y, paramEntity.realRadius() * 2f, trait.x(), trait.y())){
|
||||
trait.absorb();
|
||||
Fx.absorb.at(trait);
|
||||
|
@ -58,7 +58,7 @@ public class MassDriver extends Block{
|
||||
//check if a mass driver is selected while placing this driver
|
||||
if(!control.input.frag.config.isShown()) return;
|
||||
Building selected = control.input.frag.config.getSelectedTile();
|
||||
if(selected == null || !(selected.block() instanceof MassDriver) || !(selected.dst(x * tilesize, y * tilesize) <= range)) return;
|
||||
if(selected == null || !(selected.block() instanceof MassDriver) || !(selected.within(x * tilesize, y * tilesize, range))) return;
|
||||
|
||||
//if so, draw a dotted line towards it while it is in range
|
||||
float sin = Mathf.absin(Time.time(), 6f, 1f);
|
||||
|
Loading…
Reference in New Issue
Block a user