mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-25 22:17:59 +07:00
Unit wall mining
This commit is contained in:
parent
608e25c2ee
commit
abf429acb1
Binary file not shown.
@ -18,7 +18,7 @@ public class ErekirTechTree{
|
||||
costMultipliers.put(Items.surgeAlloy, 4);
|
||||
costMultipliers.put(Items.phaseFabric, 4);
|
||||
costMultipliers.put(Items.thorium, 9);
|
||||
costMultipliers.put(Items.graphite, 8);
|
||||
costMultipliers.put(Items.graphite, 9);
|
||||
|
||||
Planets.erekir.techTree = nodeRoot("erekir", coreBastion, true, () -> {
|
||||
context().researchCostMultipliers = costMultipliers;
|
||||
@ -71,6 +71,18 @@ public class ErekirTechTree{
|
||||
});
|
||||
});
|
||||
|
||||
//TODO move into turbine condenser?
|
||||
node(plasmaBore, () -> {
|
||||
|
||||
node(impactDrill, erekirSector, () -> {
|
||||
node(largePlasmaBore, () -> {
|
||||
node(eruptionDrill, () -> {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
node(turbineCondenser, () -> {
|
||||
node(beamNode, () -> {
|
||||
node(ventCondenser, erekirSector, () -> {
|
||||
@ -93,75 +105,63 @@ public class ErekirTechTree{
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
node(siliconArcFurnace, () -> {
|
||||
node(cliffCrusher, () -> {
|
||||
node(electrolyzer, erekirSector, () -> {
|
||||
node(oxidationChamber, () -> {
|
||||
node(electricHeater, () -> {
|
||||
node(heatRedirector, () -> {
|
||||
node(reinforcedConduit, erekirSector, () -> {
|
||||
node(reinforcedPump, () -> {
|
||||
//TODO T2 pump
|
||||
});
|
||||
|
||||
node(reinforcedLiquidJunction, () -> {
|
||||
node(reinforcedBridgeConduit, () -> {
|
||||
|
||||
});
|
||||
|
||||
node(reinforcedLiquidRouter, () -> {
|
||||
node(reinforcedLiquidContainer, () -> {
|
||||
node(reinforcedLiquidTank, () -> {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
node(atmosphericConcentrator, () -> {
|
||||
node(cyanogenSynthesizer, () -> {
|
||||
node(siliconArcFurnace, () -> {
|
||||
node(cliffCrusher, () -> {
|
||||
node(electrolyzer, erekirSector, () -> {
|
||||
node(oxidationChamber, () -> {
|
||||
node(electricHeater, () -> {
|
||||
node(heatRedirector, () -> {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
node(carbideCrucible, () -> {
|
||||
node(surgeCrucible, () -> {
|
||||
node(phaseSynthesizer, () -> {
|
||||
node(phaseHeater, () -> {
|
||||
node(atmosphericConcentrator, () -> {
|
||||
node(cyanogenSynthesizer, () -> {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
node(carbideCrucible, () -> {
|
||||
node(surgeCrucible, () -> {
|
||||
node(phaseSynthesizer, () -> {
|
||||
node(phaseHeater, () -> {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
node(slagIncinerator, () -> {
|
||||
node(slagIncinerator, () -> {
|
||||
|
||||
node(slagCentrifuge, () -> {
|
||||
node(slagCentrifuge, () -> {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
node(heatReactor, () -> {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//TODO move into turbine condenser?
|
||||
node(plasmaBore, () -> {
|
||||
|
||||
node(impactDrill, erekirSector, () -> {
|
||||
node(largePlasmaBore, () -> {
|
||||
node(eruptionDrill, () -> {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
node(reinforcedConduit, erekirSector, () -> {
|
||||
node(reinforcedPump, () -> {
|
||||
//TODO T2 pump
|
||||
});
|
||||
|
||||
node(reinforcedLiquidJunction, () -> {
|
||||
node(reinforcedBridgeConduit, () -> {
|
||||
|
||||
});
|
||||
|
||||
node(reinforcedLiquidRouter, () -> {
|
||||
node(reinforcedLiquidContainer, () -> {
|
||||
node(reinforcedLiquidTank, () -> {
|
||||
node(heatReactor, () -> {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -57,12 +57,6 @@ public class Planets{
|
||||
totalRadius += 2.6f;
|
||||
lightSrcTo = 0.5f;
|
||||
lightDstFrom = 0.2f;
|
||||
|
||||
unlockedOnLand.addAll(
|
||||
Blocks.plasmaBore, Blocks.duct,
|
||||
Blocks.turbineCondenser, Blocks.breach,
|
||||
Blocks.coreCitadel
|
||||
);
|
||||
}};
|
||||
|
||||
//TODO names
|
||||
|
@ -2700,9 +2700,11 @@ public class UnitTypes{
|
||||
|
||||
outlineColor = Pal.darkOutline;
|
||||
lowAltitude = false;
|
||||
mineWalls = true;
|
||||
mineFloor = false;
|
||||
flying = true;
|
||||
mineSpeed = 6.5f;
|
||||
mineTier = 1;
|
||||
mineSpeed = 4f;
|
||||
mineTier = 4;
|
||||
buildSpeed = 0.8f;
|
||||
drag = 0.06f;
|
||||
speed = 2.9f;
|
||||
@ -2758,9 +2760,11 @@ public class UnitTypes{
|
||||
outlineColor = Pal.darkOutline;
|
||||
lowAltitude = false;
|
||||
flying = true;
|
||||
mineWalls = true;
|
||||
targetAir = false;
|
||||
mineSpeed = 8f;
|
||||
mineTier = 2;
|
||||
mineFloor = false;
|
||||
mineSpeed = 5f;
|
||||
mineTier = 4;
|
||||
buildSpeed = 1.4f;
|
||||
drag = 0.06f;
|
||||
speed = 2.8f;
|
||||
@ -2816,8 +2820,10 @@ public class UnitTypes{
|
||||
lowAltitude = false;
|
||||
flying = true;
|
||||
targetAir = false;
|
||||
mineSpeed = 8f;
|
||||
mineTier = 3;
|
||||
mineWalls = true;
|
||||
mineFloor = false;
|
||||
mineSpeed = 6f;
|
||||
mineTier = 4;
|
||||
buildSpeed = 2f;
|
||||
drag = 0.06f;
|
||||
speed = 2.6f;
|
||||
|
@ -23,7 +23,8 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc{
|
||||
transient float mineTimer;
|
||||
@Nullable @SyncLocal Tile mineTile;
|
||||
|
||||
public boolean canMine(Item item){
|
||||
public boolean canMine(@Nullable Item item){
|
||||
if(item == null) return false;
|
||||
return type.mineTier >= item.hardness;
|
||||
}
|
||||
|
||||
@ -35,9 +36,28 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc{
|
||||
return mineTile != null && !this.<Unit>self().activelyBuilding();
|
||||
}
|
||||
|
||||
public @Nullable Item getMineResult(@Nullable Tile tile){
|
||||
if(tile == null) return null;
|
||||
Item result;
|
||||
if(type.mineFloor && tile.block() == Blocks.air){
|
||||
result = tile.drop();
|
||||
}else if(type.mineWalls){
|
||||
result = tile.wallDrop();
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
|
||||
return canMine(result) ? result : null;
|
||||
}
|
||||
|
||||
public boolean validMine(Tile tile, boolean checkDst){
|
||||
return !(tile == null || tile.block() != Blocks.air || (!within(tile.worldx(), tile.worldy(), type.miningRange) && checkDst)
|
||||
|| tile.drop() == null || !canMine(tile.drop()));
|
||||
if(tile == null) return false;
|
||||
|
||||
if(checkDst && !within(tile.worldx(), tile.worldy(), type.miningRange)){
|
||||
return false;
|
||||
}
|
||||
|
||||
return getMineResult(tile) != null;
|
||||
}
|
||||
|
||||
public boolean validMine(Tile tile){
|
||||
@ -50,9 +70,12 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc{
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
Building core = closestCore();
|
||||
if(mineTile == null) return;
|
||||
|
||||
if(core != null && mineTile != null && mineTile.drop() != null && !acceptsItem(mineTile.drop()) && within(core, mineTransferRange) && !offloadImmediately()){
|
||||
Building core = closestCore();
|
||||
Item item = getMineResult(mineTile);
|
||||
|
||||
if(core != null && item != null && !acceptsItem(item) && within(core, mineTransferRange) && !offloadImmediately()){
|
||||
int accepted = core.acceptStack(item(), stack().amount, this);
|
||||
if(accepted > 0){
|
||||
Call.transferItemTo(self(), item(), accepted,
|
||||
@ -65,8 +88,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc{
|
||||
if((!net.client() || isLocal()) && !validMine(mineTile)){
|
||||
mineTile = null;
|
||||
mineTimer = 0f;
|
||||
}else if(mining()){
|
||||
Item item = mineTile.drop();
|
||||
}else if(mining() && item != null){
|
||||
mineTimer += Time.delta *type.mineSpeed;
|
||||
|
||||
if(Mathf.chance(0.06 * Time.delta)){
|
||||
|
@ -1048,11 +1048,9 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
|
||||
boolean canMine(Tile tile){
|
||||
return !Core.scene.hasMouse()
|
||||
&& tile.drop() != null
|
||||
&& player.unit().validMine(tile)
|
||||
&& !((!Core.settings.getBool("doubletapmine") && tile.floor().playerUnmineable) && tile.overlay().itemDrop == null)
|
||||
&& player.unit().acceptsItem(tile.drop())
|
||||
&& tile.block() == Blocks.air;
|
||||
&& player.unit().acceptsItem(player.unit().getMineResult(tile))
|
||||
&& !((!Core.settings.getBool("doubletapmine") && tile.floor().playerUnmineable) && tile.overlay().itemDrop == null);
|
||||
}
|
||||
|
||||
/** Returns the tile at the specified MOUSE coordinates. */
|
||||
|
@ -127,6 +127,7 @@ public class UnitType extends UnlockableContent{
|
||||
public int ammoCapacity = -1;
|
||||
public AmmoType ammoType = new ItemAmmoType(Items.copper);
|
||||
public int mineTier = -1;
|
||||
public boolean mineWalls = false, mineFloor = true;
|
||||
public float buildSpeed = -1f, mineSpeed = 1f;
|
||||
public Sound mineSound = Sounds.minebeam;
|
||||
public float mineSoundVolume = 0.6f;
|
||||
|
@ -761,7 +761,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
}
|
||||
|
||||
if(state.planet.hasGrid()){
|
||||
hovered = state.planet.getSector(planets.cam.getMouseRay(), PlanetRenderer.outlineRad);
|
||||
hovered = Core.scene.getDialog() == this ? state.planet.getSector(planets.cam.getMouseRay(), PlanetRenderer.outlineRad) : null;
|
||||
}else if(state.planet.isLandable()){
|
||||
boolean wasNull = selected == null;
|
||||
//always have the first sector selected.
|
||||
|
Loading…
Reference in New Issue
Block a user