Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features

 Conflicts:
	core/src/mindustry/mod/ClassMap.java
This commit is contained in:
Anuken
2021-07-04 09:52:57 -04:00
34 changed files with 168 additions and 135 deletions

View File

@@ -20,7 +20,7 @@ public class PayloadConveyor extends Block{
public @Load("@-top") TextureRegion topRegion;
public @Load("@-edge") TextureRegion edgeRegion;
public Interp interp = Interp.pow5;
public float payloadLimit = 2.9f;
public float payloadLimit = 3f;
public PayloadConveyor(String name){
super(name);
@@ -75,7 +75,7 @@ public class PayloadConveyor extends Block{
@Override
public boolean canControlSelect(Player player){
return this.item == null && !player.unit().spawnedByCore && player.unit().hitSize / tilesize <= payloadLimit && player.tileOn().build == this;
return this.item == null && !player.unit().spawnedByCore && player.unit().hitSize / tilesize <= payloadLimit && player.tileOn() != null && player.tileOn().build == this;
}
@Override

View File

@@ -26,6 +26,7 @@ public interface Payload extends Position{
float size();
float x();
float y();
/** @return the items needed to make this payload; may be empty. */
@@ -39,7 +40,7 @@ public interface Payload extends Position{
return false;
}
/** @return whether this payload fits in a given size. 2.5 is the max for a standard 3x3 conveyor. */
/** @return whether this payload fits in a given size. 3 is the max for a standard 3x3 conveyor. */
default boolean fits(float s){
return size() / tilesize <= s;
}

View File

@@ -30,6 +30,7 @@ public class Separator extends Block{
solid = true;
hasItems = true;
hasLiquids = true;
sync = true;
}
@Override
@@ -45,6 +46,12 @@ public class Separator extends Block{
public float progress;
public float totalProgress;
public float warmup;
public int seed;
@Override
public void created(){
seed = Mathf.randomSeed(tile.pos(), 0, Integer.MAX_VALUE - 1);
}
@Override
public boolean shouldAmbientSound(){
@@ -91,7 +98,7 @@ public class Separator extends Block{
int sum = 0;
for(ItemStack stack : results) sum += stack.amount;
int i = Mathf.random(sum);
int i = Mathf.randomSeed(seed++, 0, sum);
int count = 0;
Item item = null;
@@ -121,11 +128,19 @@ public class Separator extends Block{
return !consumes.itemFilters.get(item.id);
}
//TODO write seed in 128 release, don't write it now for compatibility with 127.x
//@Override
//public byte version(){
// return 1;
//}
@Override
public void write(Writes write){
super.write(write);
write.f(progress);
write.f(warmup);
//TODO see above
//write.i(seed);
}
@Override
@@ -133,6 +148,8 @@ public class Separator extends Block{
super.read(read, revision);
progress = read.f();
warmup = read.f();
//TODO see above
//if(revision == 1) seed = read.i();
}
}
}

View File

@@ -10,6 +10,7 @@ import java.util.*;
public enum StatUnit{
blocks,
blocksSquared,
tilesSecond,
powerSecond,
liquidSecond,
itemsSecond,