This commit is contained in:
Anuken
2020-09-09 23:39:00 -04:00
parent 2260e6824c
commit 3b5d6860d6
56 changed files with 554 additions and 544 deletions

View File

@@ -51,6 +51,7 @@ public class GroundAI extends AIController{
if(!Units.invalidateTarget(target, unit, unit.range())){
if(unit.type().hasWeapons()){
//TODO certain units should not look at the target, e.g. ships
unit.aimLook(Predict.intercept(unit, target, unit.type().weapons.first().bullet.speed));
}
}else if(unit.moving()){

View File

@@ -64,7 +64,7 @@ public class Blocks implements ContentList{
mechanicalPump, rotaryPump, thermalPump, conduit, pulseConduit, platedConduit, liquidRouter, liquidTank, liquidJunction, bridgeConduit, phaseConduit,
//power
combustionGenerator, thermalGenerator, turbineGenerator, differentialGenerator, rtgGenerator, solarPanel, largeSolarPanel, thoriumReactor,
combustionGenerator, thermalGenerator, steamGenerator, differentialGenerator, rtgGenerator, solarPanel, largeSolarPanel, thoriumReactor,
impactReactor, battery, batteryLarge, powerNode, powerNodeLarge, surgeTower, diode,
//production
@@ -1123,7 +1123,7 @@ public class Blocks implements ContentList{
size = 2;
}};
turbineGenerator = new BurnerGenerator("turbine-generator"){{
steamGenerator = new BurnerGenerator("steam-generator"){{
requirements(Category.power, with(Items.copper, 35, Items.graphite, 25, Items.lead, 40, Items.silicon, 30));
powerProduction = 5.5f;
itemDuration = 90f;

View File

@@ -261,7 +261,7 @@ public class TechTree implements ContentList{
});
});
node(turbineGenerator, () -> {
node(steamGenerator, () -> {
node(thermalGenerator, () -> {
node(differentialGenerator, () -> {
node(thoriumReactor, () -> {
@@ -490,7 +490,7 @@ public class TechTree implements ContentList{
new SectorComplete(frozenForest),
new Research(pneumaticDrill),
new Research(powerNode),
new Research(turbineGenerator)
new Research(steamGenerator)
), () -> {
node(fungalPass, Seq.with(
new SectorComplete(stainedMountains),

View File

@@ -28,6 +28,7 @@ import mindustry.io.*;
import mindustry.world.*;
import mindustry.world.blocks.*;
import mindustry.world.blocks.distribution.*;
import mindustry.world.blocks.legacy.*;
import mindustry.world.blocks.power.*;
import mindustry.world.blocks.production.*;
import mindustry.world.blocks.sandbox.*;
@@ -486,8 +487,9 @@ public class Schematics implements Loadable{
IntMap<Block> blocks = new IntMap<>();
byte length = stream.readByte();
for(int i = 0; i < length; i++){
Block block = Vars.content.getByName(ContentType.block, stream.readUTF());
blocks.put(i, block == null ? Blocks.air : block);
String name = stream.readUTF();
Block block = Vars.content.getByName(ContentType.block, SaveFileReader.fallback.get(name, name));
blocks.put(i, block == null || block instanceof LegacyBlock ? Blocks.air : block);
}
int total = stream.readInt();

View File

@@ -125,10 +125,10 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
Unit unit = player.unit();
Payloadc pay = (Payloadc)unit;
if(tile != null && tile.team == unit.team && pay.canPickup(tile)
if(tile != null && tile.team == unit.team
&& unit.within(tile, tilesize * tile.block.size * 1.2f)){
//pick up block directly
if(tile.block().buildVisibility != BuildVisibility.hidden && tile.canPickup()){
if(tile.block().buildVisibility != BuildVisibility.hidden && tile.canPickup() && pay.canPickup(tile)){
pay.pickup(tile);
}else{ //pick up block payload
Payload current = tile.getPayload();
@@ -344,7 +344,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
}else{
Building tile = world.buildWorld(pay.x(), pay.y());
if(tile != null && tile.team == unit.team && pay.canPickup(tile)){
if(tile != null && tile.team == unit.team){
Call.pickupBlockPayload(player, tile);
}
}

View File

@@ -8,11 +8,7 @@ import mindustry.world.*;
import java.io.*;
public abstract class SaveFileReader{
protected final ReusableByteOutStream byteOutput = new ReusableByteOutStream();
protected final DataOutputStream dataBytes = new DataOutputStream(byteOutput);
protected final ReusableByteOutStream byteOutputSmall = new ReusableByteOutStream();
protected final DataOutputStream dataBytesSmall = new DataOutputStream(byteOutputSmall);
protected final ObjectMap<String, String> fallback = ObjectMap.of(
public static final ObjectMap<String, String> fallback = ObjectMap.of(
"dart-mech-pad", "legacy-mech-pad",
"dart-ship-pad", "legacy-mech-pad",
"javelin-ship-pad", "legacy-mech-pad",
@@ -35,9 +31,15 @@ public abstract class SaveFileReader{
"fortress-factory", "legacy-unit-factory",
"mass-conveyor", "payload-conveyor",
"vestige", "scepter"
"vestige", "scepter",
"turbine-generator", "steam-generator"
);
protected final ReusableByteOutStream byteOutput = new ReusableByteOutStream();
protected final DataOutputStream dataBytes = new DataOutputStream(byteOutput);
protected final ReusableByteOutStream byteOutputSmall = new ReusableByteOutStream();
protected final DataOutputStream dataBytesSmall = new DataOutputStream(byteOutputSmall);
protected int lastRegionLength;
protected void region(String name, DataInput stream, CounterInputStream counter, IORunner<DataInput> cons) throws IOException{

View File

@@ -193,20 +193,25 @@ public class PayloadConveyor extends Block{
@Override
public boolean acceptPayload(Building source, Payload payload){
if(source == this){
return this.item == null && payload.fits();
}
//accepting payloads from units isn't supported
return this.item == null && progress <= 5f && source != this && payload.fits();
return this.item == null && progress <= 5f && payload.fits();
}
@Override
public void handlePayload(Building source, Payload payload){
this.item = payload;
this.stepAccepted = curStep();
this.itemRotation = source.angleTo(this);
this.itemRotation = source == this ? rotdeg() : source.angleTo(this);
this.animation = 0;
updatePayload();
}
@Override
public void write(Writes write){
super.write(write);