Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken
2023-01-07 12:03:58 -05:00
19 changed files with 741 additions and 708 deletions

View File

@@ -1180,6 +1180,7 @@ public class Blocks{
craftTime = 10f;
rotate = true;
invertFlip = true;
group = BlockGroup.liquids;
liquidCapacity = 50f;
@@ -2470,6 +2471,7 @@ public class Blocks{
turbineCondenser = new ThermalGenerator("turbine-condenser"){{
requirements(Category.power, with(Items.beryllium, 60));
attribute = Attribute.steam;
group = BlockGroup.liquids;
displayEfficiencyScale = 1f / 9f;
minEfficiency = 9f - 0.0001f;
powerProduction = 3f / 9f;
@@ -2764,6 +2766,7 @@ public class Blocks{
ventCondenser = new AttributeCrafter("vent-condenser"){{
requirements(Category.production, with(Items.graphite, 20, Items.beryllium, 60));
attribute = Attribute.steam;
group = BlockGroup.liquids;
minEfficiency = 9f - 0.0001f;
baseEfficiency = 0f;
displayEfficiency = false;

View File

@@ -250,7 +250,7 @@ public class Control implements ApplicationListener, Loadable{
}else{
//when already hosting, instantly build everything. this looks bad but it's better than a desync
Fx.coreBuildBlock.at(build.x, build.y, 0f, build.block);
Fx.placeBlock.at(build.x, build.y, build.block.size);
build.block.placeEffect.at(build.x, build.y, build.block.size);
}
}
}
@@ -288,7 +288,7 @@ public class Control implements ApplicationListener, Loadable{
build.dropped();
Fx.coreBuildBlock.at(build.x, build.y, 0f, build.block);
Fx.placeBlock.at(build.x, build.y, build.block.size);
build.block.placeEffect.at(build.x, build.y, build.block.size);
}
@Override

View File

@@ -179,7 +179,7 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
}
Fx.unitDrop.at(tile);
Fx.placeBlock.at(on.drawx(), on.drawy(), on.block().size);
on.block().placeEffect.at(on.drawx(), on.drawy(), on.block().size);
return true;
}

View File

@@ -312,6 +312,8 @@ public class Block extends UnlockableContent implements Senseable{
public float deconstructThreshold = 0f;
/** If true, this block deconstructs immediately. Instant deconstruction implies no resource refund. */
public boolean instantDeconstruct = false;
/** Effect for placing the block. Passes size as rotation. */
public Effect placeEffect = Fx.placeBlock;
/** Effect for breaking the block. Passes size as rotation. */
public Effect breakEffect = Fx.breakBlock;
/** Effect for destroying the block. */

View File

@@ -99,7 +99,7 @@ public class ConstructBlock extends Block{
}
if(fogControl.isVisibleTile(team, tile.x, tile.y)){
Fx.placeBlock.at(tile.drawx(), tile.drawy(), block.size);
block.placeEffect.at(tile.drawx(), tile.drawy(), block.size);
if(shouldPlay()) block.placeSound.at(tile, block.placePitchChange ? calcPitch(true) : 1f);
}

View File

@@ -28,6 +28,7 @@ public class DirectionalUnloader extends Block{
public DirectionalUnloader(String name){
super(name);
group = BlockGroup.transportation;
update = true;
solid = true;
hasItems = true;

View File

@@ -503,7 +503,7 @@ public class LogicBlock extends Block{
if(state.rules.disableWorldProcessors && privileged) return;
if(enabled && executor.initialized()){
accumulator += edelta() * ipt * efficiency;
accumulator += edelta() * ipt;
if(accumulator > maxInstructionScale * ipt) accumulator = maxInstructionScale * ipt;

View File

@@ -96,7 +96,7 @@ public abstract class BlockProducer extends PayloadBlock{
if(progress >= recipe.buildCost){
consume();
payload = new BuildPayload(recipe, team);
Fx.placeBlock.at(x, y, payload.size() / tilesize);
payload.block().placeEffect.at(x, y, payload.size() / tilesize);
payVector.setZero();
progress %= 1f;
}

View File

@@ -24,7 +24,7 @@ public class PayloadConveyor extends Block{
public PayloadConveyor(String name){
super(name);
group = BlockGroup.transportation;
group = BlockGroup.payloads;
size = 3;
rotate = true;
update = true;

View File

@@ -24,13 +24,13 @@ import static mindustry.Vars.*;
public class BeamDrill extends Block{
protected Rand rand = new Rand();
public @Load("drill-laser") TextureRegion laser;
public @Load("drill-laser-end") TextureRegion laserEnd;
public @Load("drill-laser-center") TextureRegion laserCenter;
public @Load(value = "@-beam", fallback = "drill-laser") TextureRegion laser;
public @Load(value = "@-beam-end", fallback = "drill-laser-end") TextureRegion laserEnd;
public @Load(value = "@-beam-center", fallback = "drill-laser-center") TextureRegion laserCenter;
public @Load("drill-laser-boost") TextureRegion laserBoost;
public @Load("drill-laser-boost-end") TextureRegion laserEndBoost;
public @Load("drill-laser-boost-center") TextureRegion laserCenterBoost;
public @Load(value = "@-beam-boost", fallback = "drill-laser-boost") TextureRegion laserBoost;
public @Load(value = "@-beam-boost-end", fallback = "drill-laser-boost-end") TextureRegion laserEndBoost;
public @Load(value = "@-beam-boost-center", fallback = "drill-laser-boost-center") TextureRegion laserCenterBoost;
public @Load("@-top") TextureRegion topRegion;
public @Load("@-glow") TextureRegion glowRegion;
@@ -202,6 +202,7 @@ public class BeamDrill extends Block{
public float time;
public float warmup, boostWarmup;
public float lastDrillSpeed;
public int facingAmount;
@Override
public void drawSelect(){
@@ -222,40 +223,8 @@ public class BeamDrill extends Block{
if(lasers[0] == null) updateLasers();
warmup = Mathf.approachDelta(warmup, Mathf.num(efficiency > 0), 1f / 60f);
lastItem = null;
boolean multiple = false;
int dx = Geometry.d4x(rotation), dy = Geometry.d4y(rotation), facingAmount = 0;
//update facing tiles
for(int p = 0; p < size; p++){
Point2 l = lasers[p];
Tile dest = null;
for(int i = 0; i < range; i++){
int rx = l.x + dx*i, ry = l.y + dy*i;
Tile other = world.tile(rx, ry);
if(other != null){
if(other.solid()){
Item drop = other.wallDrop();
if(drop != null && drop.hardness <= tier){
facingAmount ++;
if(lastItem != drop && lastItem != null){
multiple = true;
}
lastItem = drop;
dest = other;
}
break;
}
}
}
facing[p] = dest;
}
//when multiple items are present, count that as no item
if(multiple){
lastItem = null;
}
updateFacing();
float multiplier = Mathf.lerp(1f, optionalBoostIntensity, optionalEfficiency);
boostWarmup = Mathf.lerpDelta(boostWarmup, optionalEfficiency, 0.1f);
@@ -281,7 +250,7 @@ public class BeamDrill extends Block{
@Override
public boolean shouldConsume(){
return items.total() < itemCapacity && enabled;
return items.total() < itemCapacity && lastItem != null && enabled;
}
@Override
@@ -369,15 +338,54 @@ public class BeamDrill extends Block{
public void onProximityUpdate(){
//when rotated.
updateLasers();
updateFacing();
}
void updateLasers(){
protected void updateLasers(){
for(int i = 0; i < size; i++){
if(lasers[i] == null) lasers[i] = new Point2();
nearbySide(tileX(), tileY(), rotation, i, lasers[i]);
}
}
protected void updateFacing(){
lastItem = null;
boolean multiple = false;
int dx = Geometry.d4x(rotation), dy = Geometry.d4y(rotation);
facingAmount = 0;
//update facing tiles
for(int p = 0; p < size; p++){
Point2 l = lasers[p];
Tile dest = null;
for(int i = 0; i < range; i++){
int rx = l.x + dx*i, ry = l.y + dy*i;
Tile other = world.tile(rx, ry);
if(other != null){
if(other.solid()){
Item drop = other.wallDrop();
if(drop != null && drop.hardness <= tier){
facingAmount ++;
if(lastItem != drop && lastItem != null){
multiple = true;
}
lastItem = drop;
dest = other;
}
break;
}
}
}
facing[p] = dest;
}
//when multiple items are present, count that as no item
if(multiple){
lastItem = null;
}
}
@Override
public byte version(){
return 1;

View File

@@ -150,7 +150,7 @@ public class CoreBlock extends StorageBlock{
//finish placement immediately when a block is replaced.
if(previous instanceof CoreBlock){
tile.setBlock(this, tile.team());
Fx.placeBlock.at(tile, tile.block().size);
tile.block().placeEffect.at(tile, tile.block().size);
Fx.upgradeCore.at(tile.drawx(), tile.drawy(), 0f, tile.block());
Fx.upgradeCoreBloom.at(tile, tile.block().size);

View File

@@ -9,8 +9,9 @@ import mindustry.gen.*;
import mindustry.world.*;
public class DrawPistons extends DrawBlock{
public float sinMag = 4f, sinScl = 6f, sinOffset = 50f, sideOffset = 0f, lenOffset = -1f;
public float sinMag = 4f, sinScl = 6f, sinOffset = 50f, sideOffset = 0f, lenOffset = -1f, angleOffset = 0f;
public int sides = 4;
public String suffix = "-piston";
public TextureRegion region1, region2, regiont;
@Override
@@ -22,7 +23,7 @@ public class DrawPistons extends DrawBlock{
public void draw(Building build){
for(int i = 0; i < sides; i++){
float len = Mathf.absin(build.totalProgress() + sinOffset + sideOffset * sinScl * i, sinScl, sinMag) + lenOffset;
float angle = i * 360f / sides;
float angle = angleOffset + i * 360f / sides;
TextureRegion reg =
regiont.found() && (Mathf.equal(angle, 315) || Mathf.equal(angle, 135)) ? regiont :
angle >= 135 && angle < 315 ? region2 : region1;
@@ -41,8 +42,8 @@ public class DrawPistons extends DrawBlock{
public void load(Block block){
super.load(block);
region1 = Core.atlas.find(block.name + "-piston0", block.name + "-piston");
region2 = Core.atlas.find(block.name + "-piston1", block.name + "-piston");
regiont = Core.atlas.find(block.name + "-piston-t");
region1 = Core.atlas.find(block.name + suffix + "0", block.name + suffix);
region2 = Core.atlas.find(block.name + suffix + "1", block.name + suffix);
regiont = Core.atlas.find(block.name + suffix + "-t");
}
}

View File

@@ -15,11 +15,11 @@ public class StatUnit{
blocks = new StatUnit("blocks"),
blocksSquared = new StatUnit("blocksSquared"),
tilesSecond = new StatUnit("tilesSecond"),
powerSecond = new StatUnit("powerSecond"),
powerSecond = new StatUnit("powerSecond", "[accent]" + Iconc.power + "[]"),
liquidSecond = new StatUnit("liquidSecond"),
itemsSecond = new StatUnit("itemsSecond"),
liquidUnits = new StatUnit("liquidUnits"),
powerUnits = new StatUnit("powerUnits"),
powerUnits = new StatUnit("powerUnits", "[accent]" + Iconc.power + "[]"),
heatUnits = new StatUnit("heatUnits", "[red]" + Iconc.waves + "[]"),
degrees = new StatUnit("degrees"),
seconds = new StatUnit("seconds"),

View File

@@ -329,7 +329,7 @@ public class StatValues{
if(type.spawnUnit != null && type.spawnUnit.weapons.size > 0){
ammo(ObjectMap.of(t, type.spawnUnit.weapons.first().bullet), indent, false).display(table);
return;
continue;
}
//no point in displaying unit icon twice