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

 Conflicts:
	core/src/mindustry/world/blocks/environment/Floor.java
	core/src/mindustry/world/blocks/payloads/Payload.java
	gradle.properties
This commit is contained in:
Anuken
2021-07-15 09:13:35 -04:00
61 changed files with 571 additions and 262 deletions

View File

@@ -193,8 +193,10 @@ public class Block extends UnlockableContent{
public int outlinedIcon = -1;
/** Whether this block has a shadow under it. */
public boolean hasShadow = true;
/** Sounds made when this block breaks.*/
public Sound breakSound = Sounds.boom;
/** Sounds made when this block is destroyed.*/
public Sound destroySound = Sounds.boom;
/** Sound made when this block is deconstructed. */
public Sound breakSound = Sounds.breaks;
/** How reflective this block is. */
public float albedo = 0f;
/** Environmental passive light color. */

View File

@@ -47,7 +47,7 @@ public class ConstructBlock extends Block{
/** Returns a ConstructBlock by size. */
public static ConstructBlock get(int size){
if(size > maxBlockSize) throw new IllegalArgumentException("No. Don't place ConstructBlock of size greater than " + maxBlockSize);
if(size > maxBlockSize) throw new IllegalArgumentException("No. Don't place ConstructBlocks of size greater than " + maxBlockSize);
return consBlocks[size - 1];
}
@@ -57,7 +57,7 @@ public class ConstructBlock extends Block{
block.breakEffect.at(tile.drawx(), tile.drawy(), block.size, block.mapColor);
Events.fire(new BlockBuildEndEvent(tile, builder, team, true, null));
tile.remove();
if(shouldPlay()) Sounds.breaks.at(tile, calcPitch(false));
if(shouldPlay()) block.breakSound.at(tile, calcPitch(false));
}
@Remote(called = Loc.server)

View File

@@ -129,8 +129,8 @@ public class LaunchPad extends Block{
public void updateTile(){
if(!state.isCampaign()) return;
//launch when full and base conditions are met
if(items.total() >= itemCapacity && efficiency() >= 1f && (launchCounter += edelta()) >= launchTime){
//increment launchCounter then launch when full and base conditions are met
if((launchCounter += edelta()) >= launchTime && items.total() >= itemCapacity){
launchSound.at(x, y);
LaunchPayload entity = LaunchPayload.create();
items.each((item, amount) -> entity.stacks.add(new ItemStack(item, amount)));

View File

@@ -246,7 +246,7 @@ public class Conveyor extends Block implements Autotiler{
if(ys[i] > nextMax) ys[i] = nextMax;
if(ys[i] > 0.5 && i > 0) mid = i - 1;
xs[i] = Mathf.approachDelta(xs[i], 0, speed*2);
xs[i] = Mathf.approach(xs[i], 0, moved*2);
if(ys[i] >= 1f && pass(ids[i])){
//align X position if passing forwards
@@ -262,7 +262,7 @@ public class Conveyor extends Block implements Autotiler{
}
if(minitem < itemSpace + (blendbits == 1 ? 0.3f : 0f)){
clogHeat = Mathf.lerpDelta(clogHeat, 1f, 0.02f);
clogHeat = Mathf.approachDelta(clogHeat, 1f, 1f / 60f);
}else{
clogHeat = 0f;
}

View File

@@ -51,8 +51,6 @@ public class Floor extends Block{
public boolean playerUnmineable = false;
/** Group of blocks that this block does not draw edges on. */
public Block blendGroup = this;
/** Effect displayed when randomly updated. */
public Effect updateEffect = Fx.none;
/** Whether this ore generates in maps by default. */
public boolean oreDefault = false;
/** Ore generation params. */

View File

@@ -4,15 +4,18 @@ import arc.*;
import arc.graphics.g2d.*;
import arc.math.*;
import mindustry.content.*;
import mindustry.gen.*;
import mindustry.world.*;
public class Prop extends Block{
public Prop(String name){
super(name);
breakable = true;
alwaysReplace = true;
instantDeconstruct = true;
breakEffect = Fx.breakProp;
breakSound = Sounds.rockBreak;
}
@Override

View File

@@ -6,6 +6,7 @@ import arc.util.*;
import arc.util.io.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.ui.*;
import mindustry.type.*;
import mindustry.world.*;
@@ -56,6 +57,12 @@ public interface Payload extends Position{
/** @return icon describing the contents. */
TextureRegion icon();
/** @deprecated use icon() instead. */
@Deprecated
default TextureRegion icon(Cicon icon){
return icon();
}
@Override
default float getX(){
return x();

View File

@@ -456,6 +456,7 @@ public class PayloadMassDriver extends PayloadBlock{
@Override
public Point2 config(){
if(tile == null) return null;
return Point2.unpack(link).sub(tile.x, tile.y);
}

View File

@@ -15,7 +15,10 @@ import mindustry.world.draw.*;
import mindustry.world.meta.*;
public class GenericCrafter extends Block{
/** Written to outputItems as a single-element array if outputItems is null. */
public @Nullable ItemStack outputItem;
/** Overwrites outputItem if not null. */
public @Nullable ItemStack[] outputItems;
public @Nullable LiquidStack outputLiquid;
public float craftTime = 80;
@@ -45,8 +48,8 @@ public class GenericCrafter extends Block{
super.setStats();
stats.add(Stat.productionTime, craftTime / 60f, StatUnit.seconds);
if(outputItem != null){
stats.add(Stat.output, StatValues.items(craftTime, outputItem));
if(outputItems != null){
stats.add(Stat.output, StatValues.items(craftTime, outputItems));
}
if(outputLiquid != null){
@@ -64,6 +67,9 @@ public class GenericCrafter extends Block{
@Override
public void init(){
outputsLiquid = outputLiquid != null;
if(outputItems == null && outputItem != null){
outputItems = new ItemStack[]{outputItem};
}
super.init();
}
@@ -74,7 +80,7 @@ public class GenericCrafter extends Block{
@Override
public boolean outputsItems(){
return outputItem != null;
return outputItems != null;
}
public class GenericCrafterBuild extends Building{
@@ -95,8 +101,12 @@ public class GenericCrafter extends Block{
@Override
public boolean shouldConsume(){
if(outputItem != null && items.get(outputItem.item) + outputItem.amount > itemCapacity){
return false;
if(outputItems != null){
for(ItemStack output : outputItems){
if(items.get(output.item) + output.amount > itemCapacity){
return false;
}
}
}
return (outputLiquid == null || !(liquids.get(outputLiquid.liquid) >= liquidCapacity - 0.001f)) && enabled;
}
@@ -119,9 +129,11 @@ public class GenericCrafter extends Block{
if(progress >= 1f){
consume();
if(outputItem != null){
for(int i = 0; i < outputItem.amount; i++){
offload(outputItem.item);
if(outputItems != null){
for(ItemStack output : outputItems){
for(int i = 0; i < output.amount; i++){
offload(output.item);
}
}
}
@@ -133,8 +145,10 @@ public class GenericCrafter extends Block{
progress %= 1f;
}
if(outputItem != null && timer(timerDump, dumpTime / timeScale)){
dump(outputItem.item);
if(outputItems != null && timer(timerDump, dumpTime / timeScale)){
for(ItemStack output : outputItems){
dump(output.item);
}
}
if(outputLiquid != null){
@@ -174,4 +188,4 @@ public class GenericCrafter extends Block{
if(legacyReadWarmup) read.f();
}
}
}
}

View File

@@ -281,7 +281,7 @@ public class CoreBlock extends StorageBlock{
@Override
public void afterDestroyed(){
if(state.rules.coreCapture){
tile.setBlock(block, lastDamage);
tile.setNet(block, lastDamage, 0);
//core is invincible for several seconds to prevent recapture
((CoreBuild)tile.build).iframes = captureInvicibility;
}

View File

@@ -147,7 +147,7 @@ public class StatValues{
}
}
}else{
c.add("@none.found");
c.add("@none.inmap");
}
}else{
c.add("@stat.showinmap");