Bugfixes & cleanup
|
Before Width: | Height: | Size: 792 B After Width: | Height: | Size: 826 B |
|
Before Width: | Height: | Size: 189 KiB After Width: | Height: | Size: 185 KiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 190 KiB After Width: | Height: | Size: 186 KiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
@@ -68,8 +68,6 @@ public class Vars implements Loadable{
|
|||||||
public static final String reportIssueURL = "https://github.com/Anuken/Mindustry/issues/new?labels=bug&template=bug_report.md";
|
public static final String reportIssueURL = "https://github.com/Anuken/Mindustry/issues/new?labels=bug&template=bug_report.md";
|
||||||
/** list of built-in servers.*/
|
/** list of built-in servers.*/
|
||||||
public static final Seq<String> defaultServers = Seq.with();
|
public static final Seq<String> defaultServers = Seq.with();
|
||||||
/** whether multi-tile mining is enabled */
|
|
||||||
public static final boolean multimine = false;
|
|
||||||
/** maximum distance between mine and core that supports automatic transferring */
|
/** maximum distance between mine and core that supports automatic transferring */
|
||||||
public static final float mineTransferRange = 220f;
|
public static final float mineTransferRange = 220f;
|
||||||
/** max chat message length */
|
/** max chat message length */
|
||||||
|
|||||||
@@ -314,25 +314,7 @@ public class BlockIndexer{
|
|||||||
|
|
||||||
/** Find the closest ore block relative to a position. */
|
/** Find the closest ore block relative to a position. */
|
||||||
public Tile findClosestOre(Unit unit, Item item){
|
public Tile findClosestOre(Unit unit, Item item){
|
||||||
if(multimine) return findClosestOre(unit.x, unit.y, item);
|
return findClosestOre(unit.x, unit.y, item);
|
||||||
if(!(unit instanceof Minerc miner)) return null;
|
|
||||||
|
|
||||||
TileArray arr = getOrePositions(item);
|
|
||||||
|
|
||||||
arr.tiles.sort(t -> t.dst2(unit.x, unit.y));
|
|
||||||
|
|
||||||
for(Tile tile : arr.tiles){
|
|
||||||
for(int x = Math.max(0, tile.x - quadrantSize / 2); x < tile.x + quadrantSize / 2 && x < world.width(); x++){
|
|
||||||
for(int y = Math.max(0, tile.y - quadrantSize / 2); y < tile.y + quadrantSize / 2 && y < world.height(); y++){
|
|
||||||
Tile res = world.tile(x, y);
|
|
||||||
if(res.drop() == item && miner.validMine(res, false)){
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return extra unit cap of a team. This is added onto the base value. */
|
/** @return extra unit cap of a team. This is added onto the base value. */
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ import mindustry.type.*;
|
|||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.blocks.storage.CoreBlock.*;
|
import mindustry.world.blocks.storage.CoreBlock.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
|
||||||
|
|
||||||
public class FormationAI extends AIController implements FormationMember{
|
public class FormationAI extends AIController implements FormationMember{
|
||||||
private static Seq<Tile> tiles = new Seq<>();
|
private static Seq<Tile> tiles = new Seq<>();
|
||||||
public Unit leader;
|
public Unit leader;
|
||||||
@@ -67,22 +65,8 @@ public class FormationAI extends AIController implements FormationMember{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(unit instanceof Minerc mine && leader instanceof Minerc com){
|
if(unit instanceof Minerc mine && leader instanceof Minerc com){
|
||||||
if(com.mineTile() != null){
|
if(com.mineTile() != null && mine.validMine(com.mineTile())){
|
||||||
if(multimine){
|
mine.mineTile(com.mineTile());
|
||||||
mine.mineTile(mine.validMine(com.mineTile()) ? com.mineTile() : null);
|
|
||||||
}else{
|
|
||||||
if(mine.mineTile() == null){
|
|
||||||
tiles.clear();
|
|
||||||
com.mineTile().circle(6, (cx, cy) -> {
|
|
||||||
Tile tile = world.tile(cx, cy);
|
|
||||||
if(mine.validMine(tile) && tile.drop() == com.mineTile().drop() && tile != com.mineTile()){
|
|
||||||
tiles.add(tile);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Tile min = tiles.min(t -> t.dst2(com.mineTile()));
|
|
||||||
mine.mineTile(min);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CoreBuild core = unit.team.core();
|
CoreBuild core = unit.team.core();
|
||||||
|
|
||||||
|
|||||||
@@ -1127,17 +1127,17 @@ public class UnitTypes implements ContentList{
|
|||||||
flying = true;
|
flying = true;
|
||||||
drag = 0.06f;
|
drag = 0.06f;
|
||||||
accel = 0.12f;
|
accel = 0.12f;
|
||||||
speed = 2f;
|
speed = 1.5f;
|
||||||
health = 100;
|
health = 100;
|
||||||
engineSize = 1.8f;
|
engineSize = 1.8f;
|
||||||
engineOffset = 5.7f;
|
engineOffset = 5.7f;
|
||||||
range = 56f;
|
range = 50f;
|
||||||
isCounted = false;
|
isCounted = false;
|
||||||
|
|
||||||
ammoType = AmmoTypes.powerLow;
|
ammoType = AmmoTypes.powerLow;
|
||||||
|
|
||||||
mineTier = 1;
|
mineTier = 1;
|
||||||
mineSpeed = 3f;
|
mineSpeed = 2.5f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
poly = new UnitType("poly"){{
|
poly = new UnitType("poly"){{
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc, Unitc{
|
|||||||
|
|
||||||
public boolean validMine(Tile tile, boolean checkDst){
|
public boolean validMine(Tile tile, boolean checkDst){
|
||||||
return !(tile == null || tile.block() != Blocks.air || (!within(tile.worldx(), tile.worldy(), miningRange) && checkDst)
|
return !(tile == null || tile.block() != Blocks.air || (!within(tile.worldx(), tile.worldy(), miningRange) && checkDst)
|
||||||
|| tile.drop() == null || !canMine(tile.drop())) && state.teams.isValidMine(self(), tile);
|
|| tile.drop() == null || !canMine(tile.drop()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean validMine(Tile tile){
|
public boolean validMine(Tile tile){
|
||||||
@@ -62,7 +62,6 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc, Unitc{
|
|||||||
mineTile = null;
|
mineTile = null;
|
||||||
mineTimer = 0f;
|
mineTimer = 0f;
|
||||||
}else if(mining()){
|
}else if(mining()){
|
||||||
state.teams.registerMined(mineTile, self());
|
|
||||||
Item item = mineTile.drop();
|
Item item = mineTile.drop();
|
||||||
lookAt(angleTo(mineTile.worldx(), mineTile.worldy()));
|
lookAt(angleTo(mineTile.worldx(), mineTile.worldy()));
|
||||||
mineTimer += Time.delta *type.mineSpeed;
|
mineTimer += Time.delta *type.mineSpeed;
|
||||||
@@ -105,7 +104,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc, Unitc{
|
|||||||
float ex = mineTile.worldx() + Mathf.sin(Time.time() + 48, swingScl, swingMag);
|
float ex = mineTile.worldx() + Mathf.sin(Time.time() + 48, swingScl, swingMag);
|
||||||
float ey = mineTile.worldy() + Mathf.sin(Time.time() + 48, swingScl + 2f, swingMag);
|
float ey = mineTile.worldy() + Mathf.sin(Time.time() + 48, swingScl + 2f, swingMag);
|
||||||
|
|
||||||
Draw.z(multimine ? Layer.flyingUnit + 0.1f : Layer.flyingUnitLow - 0.1f);
|
Draw.z(Layer.flyingUnit + 0.1f);
|
||||||
|
|
||||||
Draw.color(Color.lightGray, Color.white, 1f - flashScl + Mathf.absin(Time.time(), 0.5f, flashScl));
|
Draw.color(Color.lightGray, Color.white, 1f - flashScl + Mathf.absin(Time.time(), 0.5f, flashScl));
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import mindustry.content.*;
|
|||||||
import mindustry.entities.units.*;
|
import mindustry.entities.units.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.world.*;
|
|
||||||
import mindustry.world.blocks.payloads.*;
|
import mindustry.world.blocks.payloads.*;
|
||||||
import mindustry.world.blocks.storage.CoreBlock.*;
|
import mindustry.world.blocks.storage.CoreBlock.*;
|
||||||
|
|
||||||
@@ -27,8 +26,6 @@ public class Teams{
|
|||||||
public Seq<TeamData> active = new Seq<>();
|
public Seq<TeamData> active = new Seq<>();
|
||||||
/** Teams with block or unit presence. */
|
/** Teams with block or unit presence. */
|
||||||
public Seq<TeamData> present = new Seq<>(TeamData.class);
|
public Seq<TeamData> present = new Seq<>(TeamData.class);
|
||||||
/** Ores currently being mined. */
|
|
||||||
private IntMap<Unit> mined = new IntMap<>();
|
|
||||||
|
|
||||||
public Teams(){
|
public Teams(){
|
||||||
active.add(get(Team.crux));
|
active.add(get(Team.crux));
|
||||||
@@ -145,21 +142,7 @@ public class Teams{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return whether this ore is not taken. */
|
|
||||||
public boolean isValidMine(Unit unit, Tile tile){
|
|
||||||
if(multimine) return true;
|
|
||||||
if(tile == null) return false;
|
|
||||||
Unit u = mined.get(tile.pos());
|
|
||||||
return u == unit || u == null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerMined(Tile tile, Unit unit){
|
|
||||||
if(tile == null || unit == null || multimine) return;
|
|
||||||
mined.put(tile.pos(), unit);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateTeamStats(){
|
public void updateTeamStats(){
|
||||||
mined.clear();
|
|
||||||
present.clear();
|
present.clear();
|
||||||
|
|
||||||
for(Team team : Team.all){
|
for(Team team : Team.all){
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ public enum BuildVisibility{
|
|||||||
hidden(() -> false),
|
hidden(() -> false),
|
||||||
shown(() -> true),
|
shown(() -> true),
|
||||||
debugOnly(() -> false),
|
debugOnly(() -> false),
|
||||||
sandboxOnly(() -> Vars.state.rules.infiniteResources),
|
sandboxOnly(() -> Vars.state == null || Vars.state.rules.infiniteResources),
|
||||||
campaignOnly(() -> Vars.state.isCampaign()),
|
campaignOnly(() -> Vars.state == null || Vars.state.isCampaign()),
|
||||||
lightingOnly(() -> Vars.state.rules.lighting || Vars.state.isCampaign()),
|
lightingOnly(() -> Vars.state == null || Vars.state.rules.lighting || Vars.state.isCampaign()),
|
||||||
ammoOnly(() -> Vars.state.rules.unitAmmo);
|
ammoOnly(() -> Vars.state == null || Vars.state.rules.unitAmmo);
|
||||||
|
|
||||||
private final Boolp visible;
|
private final Boolp visible;
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import arc.math.geom.*;
|
|||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.util.noise.*;
|
import arc.util.noise.*;
|
||||||
|
import mindustry.content.*;
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
@@ -304,6 +305,10 @@ public class Generators{
|
|||||||
scaled.drawScaled(image);
|
scaled.drawScaled(image);
|
||||||
scaled.save("../ui/block-" + block.name + "-" + icon.name());
|
scaled.save("../ui/block-" + block.name + "-" + icon.name());
|
||||||
|
|
||||||
|
if(block == Blocks.itemVoid){
|
||||||
|
Log.info("saving VOID icon @ / @", icon, "../ui/block-" + block.name + "-" + icon.name());
|
||||||
|
}
|
||||||
|
|
||||||
if(icon == logicIcon && block.synthetic() && !block.isHidden()){
|
if(icon == logicIcon && block.synthetic() && !block.isHidden()){
|
||||||
image.save(block.name + "-icon-logic");
|
image.save(block.name + "-icon-logic");
|
||||||
}
|
}
|
||||||
|
|||||||