More pathfinding fixes
This commit is contained in:
@@ -90,7 +90,7 @@ public class Vars{
|
|||||||
//whether turrets have infinite ammo (only with debug)
|
//whether turrets have infinite ammo (only with debug)
|
||||||
public static boolean infiniteAmmo = true;
|
public static boolean infiniteAmmo = true;
|
||||||
//whether to show paths of enemies
|
//whether to show paths of enemies
|
||||||
public static boolean showPaths = false;
|
public static boolean showPaths = true;
|
||||||
//if false, player is always hidden
|
//if false, player is always hidden
|
||||||
public static boolean showPlayer = true;
|
public static boolean showPlayer = true;
|
||||||
//whether to hide ui, only on debug
|
//whether to hide ui, only on debug
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.badlogic.gdx.utils.ObjectSet;
|
|||||||
import com.badlogic.gdx.utils.ObjectSet.ObjectSetIterator;
|
import com.badlogic.gdx.utils.ObjectSet.ObjectSetIterator;
|
||||||
import com.badlogic.gdx.utils.Queue;
|
import com.badlogic.gdx.utils.Queue;
|
||||||
import com.badlogic.gdx.utils.TimeUtils;
|
import com.badlogic.gdx.utils.TimeUtils;
|
||||||
import io.anuke.mindustry.content.blocks.Blocks;
|
|
||||||
import io.anuke.mindustry.game.EventType.TileChangeEvent;
|
import io.anuke.mindustry.game.EventType.TileChangeEvent;
|
||||||
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
|
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
@@ -89,8 +88,8 @@ public class Pathfinder{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean passable(Tile tile, Team team){
|
private boolean passable(Tile tile, Team team){
|
||||||
return (tile.block() == Blocks.air && !tile.floor().isLiquid && !tile.hasCliffs() && !tile.floor().solid && !(tile.floor().isLiquid && (tile.floor().damageTaken > 0 || tile.floor().drownTime > 0)))
|
return (!tile.solid() && !(tile.floor().isLiquid && (tile.floor().damageTaken > 0 || tile.floor().drownTime > 0)))
|
||||||
|| (tile.breakable() && (tile.getTeam() != team)) || !tile.solid();
|
|| (tile.breakable() && (tile.target().getTeam() != team));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void update(Tile tile, Team team){
|
private void update(Tile tile, Team team){
|
||||||
|
|||||||
@@ -109,8 +109,8 @@ public class Recipes implements ContentList{
|
|||||||
new Recipe(distribution, StorageBlocks.vault, new ItemStack(Items.carbide, 500), new ItemStack(Items.thorium, 350));
|
new Recipe(distribution, StorageBlocks.vault, new ItemStack(Items.carbide, 500), new ItemStack(Items.thorium, 350));
|
||||||
|
|
||||||
//DRILLS, PRODUCERS
|
//DRILLS, PRODUCERS
|
||||||
new Recipe(production, ProductionBlocks.tungstenDrill, new ItemStack(Items.tungsten, 40));
|
new Recipe(production, ProductionBlocks.tungstenDrill, new ItemStack(Items.tungsten, 50));
|
||||||
new Recipe(production, ProductionBlocks.carbideDrill, new ItemStack(Items.tungsten, 50), new ItemStack(Items.carbide, 40));
|
new Recipe(production, ProductionBlocks.carbideDrill, new ItemStack(Items.tungsten, 60), new ItemStack(Items.carbide, 50));
|
||||||
new Recipe(production, ProductionBlocks.laserdrill, new ItemStack(Items.tungsten, 70), new ItemStack(Items.carbide, 90), new ItemStack(Items.silicon, 60), new ItemStack(Items.titanium, 50));
|
new Recipe(production, ProductionBlocks.laserdrill, new ItemStack(Items.tungsten, 70), new ItemStack(Items.carbide, 90), new ItemStack(Items.silicon, 60), new ItemStack(Items.titanium, 50));
|
||||||
new Recipe(production, ProductionBlocks.blastdrill, new ItemStack(Items.tungsten, 130), new ItemStack(Items.carbide, 180), new ItemStack(Items.silicon, 120), new ItemStack(Items.titanium, 100), new ItemStack(Items.thorium, 60));
|
new Recipe(production, ProductionBlocks.blastdrill, new ItemStack(Items.tungsten, 130), new ItemStack(Items.carbide, 180), new ItemStack(Items.silicon, 120), new ItemStack(Items.titanium, 100), new ItemStack(Items.thorium, 60));
|
||||||
|
|
||||||
|
|||||||
@@ -263,10 +263,10 @@ public class Renderer extends RendererModule{
|
|||||||
drawAndInterpolate(playerGroup, p -> true, Player::drawBuildRequests);
|
drawAndInterpolate(playerGroup, p -> true, Player::drawBuildRequests);
|
||||||
overlays.drawTop();
|
overlays.drawTop();
|
||||||
|
|
||||||
Graphics.flushSurface();
|
|
||||||
|
|
||||||
if(showPaths && debug) drawDebug();
|
if(showPaths && debug) drawDebug();
|
||||||
|
|
||||||
|
Graphics.flushSurface();
|
||||||
|
|
||||||
batch.end();
|
batch.end();
|
||||||
|
|
||||||
if(showFog){
|
if(showFog){
|
||||||
|
|||||||
@@ -265,8 +265,9 @@ public abstract class GroundUnit extends BaseUnit{
|
|||||||
protected void moveAwayFromCore(){
|
protected void moveAwayFromCore(){
|
||||||
Tile tile = world.tileWorld(x, y);
|
Tile tile = world.tileWorld(x, y);
|
||||||
Tile targetTile = world.pathfinder().getTargetTile(Vars.state.teams.enemiesOf(team).first(), tile);
|
Tile targetTile = world.pathfinder().getTargetTile(Vars.state.teams.enemiesOf(team).first(), tile);
|
||||||
|
TileEntity core = getClosestCore();
|
||||||
|
|
||||||
if(tile == targetTile) return;
|
if(tile == targetTile || core == null || distanceTo(core) < 90f) return;
|
||||||
|
|
||||||
vec.trns(baseRotation, type.speed);
|
vec.trns(baseRotation, type.speed);
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,18 @@ public class DesktopInput extends InputHandler{
|
|||||||
ui.listfrag.toggle();
|
ui.listfrag.toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(player.isDead() || state.is(State.menu) || ui.hasDialog()) return;
|
if(state.is(State.menu) || ui.hasDialog()) return;
|
||||||
|
|
||||||
|
boolean controller = KeyBinds.getSection(section).device.type == DeviceType.controller;
|
||||||
|
|
||||||
|
//zoom and rotate things
|
||||||
|
if(Inputs.getAxisActive("zoom") && (Inputs.keyDown(section, "zoom_hold") || controller)){
|
||||||
|
renderer.scaleCamera((int) Inputs.getAxisTapped(section, "zoom"));
|
||||||
|
}
|
||||||
|
|
||||||
|
renderer.minimap().zoomBy(-(int) Inputs.getAxisTapped(section, "zoom_minimap"));
|
||||||
|
|
||||||
|
if(player.isDead()) return;
|
||||||
|
|
||||||
if(recipe != null && !Settings.getBool("desktop-place-help", false)){
|
if(recipe != null && !Settings.getBool("desktop-place-help", false)){
|
||||||
ui.showInfo("Desktop controls have been changed.\nTo deselect a block or stop building, [accent]use the middle mouse button[].");
|
ui.showInfo("Desktop controls have been changed.\nTo deselect a block or stop building, [accent]use the middle mouse button[].");
|
||||||
@@ -175,14 +186,6 @@ public class DesktopInput extends InputHandler{
|
|||||||
selectScale = 0f;
|
selectScale = 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean controller = KeyBinds.getSection(section).device.type == DeviceType.controller;
|
|
||||||
|
|
||||||
//zoom and rotate things
|
|
||||||
if(Inputs.getAxisActive("zoom") && (Inputs.keyDown(section, "zoom_hold") || controller)){
|
|
||||||
renderer.scaleCamera((int) Inputs.getAxisTapped(section, "zoom"));
|
|
||||||
}
|
|
||||||
|
|
||||||
renderer.minimap().zoomBy(-(int) Inputs.getAxisTapped(section, "zoom_minimap"));
|
|
||||||
rotation = Mathf.mod(rotation + (int) Inputs.getAxisTapped(section, "rotate"), 4);
|
rotation = Mathf.mod(rotation + (int) Inputs.getAxisTapped(section, "rotate"), 4);
|
||||||
|
|
||||||
Tile cursor = tileAt(control.gdxInput().getX(), control.gdxInput().getY());
|
Tile cursor = tileAt(control.gdxInput().getX(), control.gdxInput().getY());
|
||||||
|
|||||||
@@ -42,8 +42,10 @@ public class HudFragment extends Fragment{
|
|||||||
private boolean shown = true;
|
private boolean shown = true;
|
||||||
private float dsize = 58;
|
private float dsize = 58;
|
||||||
private float isize = 40;
|
private float isize = 40;
|
||||||
|
|
||||||
private float coreAttackTime;
|
private float coreAttackTime;
|
||||||
private float lastCoreHP;
|
private float lastCoreHP;
|
||||||
|
private float coreAttackOpacity = 0f;
|
||||||
|
|
||||||
public void build(Group parent){
|
public void build(Group parent){
|
||||||
|
|
||||||
@@ -155,11 +157,16 @@ public class HudFragment extends Fragment{
|
|||||||
}
|
}
|
||||||
lastCoreHP = curr;
|
lastCoreHP = curr;
|
||||||
|
|
||||||
t.getColor().a = Mathf.clamp(coreAttackTime / 30f);
|
t.getColor().a = coreAttackOpacity;
|
||||||
|
if(coreAttackTime > 0){
|
||||||
|
coreAttackOpacity = Mathf.lerpDelta(coreAttackOpacity, 1f, 0.1f);
|
||||||
|
}else{
|
||||||
|
coreAttackOpacity = Mathf.lerpDelta(coreAttackOpacity, 0f, 0.1f);
|
||||||
|
}
|
||||||
|
|
||||||
coreAttackTime -= Timers.delta();
|
coreAttackTime -= Timers.delta();
|
||||||
|
|
||||||
return coreAttackTime > 0;
|
return coreAttackOpacity > 0;
|
||||||
});
|
});
|
||||||
t.table("clear", top -> top.add("$text.coreattack").pad(6)
|
t.table("clear", top -> top.add("$text.coreattack").pad(6)
|
||||||
.update(label -> label.setColor(Hue.mix(Color.ORANGE, Color.SCARLET, Mathf.absin(Timers.time(), 2f, 1f)))));
|
.update(label -> label.setColor(Hue.mix(Color.ORANGE, Color.SCARLET, Mathf.absin(Timers.time(), 2f, 1f)))));
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import java.io.IOException;
|
|||||||
public class UnitPad extends Block{
|
public class UnitPad extends Block{
|
||||||
protected float gracePeriodMultiplier = 16f;
|
protected float gracePeriodMultiplier = 16f;
|
||||||
protected float speedupTime = 60f * 60f * 16;
|
protected float speedupTime = 60f * 60f * 16;
|
||||||
|
protected float maxSpeedup = 7f;
|
||||||
|
|
||||||
protected UnitType type;
|
protected UnitType type;
|
||||||
protected float produceTime = 1000f;
|
protected float produceTime = 1000f;
|
||||||
@@ -165,7 +166,7 @@ public class UnitPad extends Block{
|
|||||||
}
|
}
|
||||||
//check if grace period had passed
|
//check if grace period had passed
|
||||||
}else if(entity.warmup > produceTime*gracePeriodMultiplier * Vars.state.difficulty.spawnerScaling){
|
}else if(entity.warmup > produceTime*gracePeriodMultiplier * Vars.state.difficulty.spawnerScaling){
|
||||||
float speedMultiplier = Math.min(0.1f + (entity.warmup - produceTime * gracePeriodMultiplier * Vars.state.difficulty.spawnerScaling) / speedupTime, 4f);
|
float speedMultiplier = Math.min(0.1f + (entity.warmup - produceTime * gracePeriodMultiplier * Vars.state.difficulty.spawnerScaling) / speedupTime, maxSpeedup);
|
||||||
//otherwise, it's an enemy, cheat by not requiring resources
|
//otherwise, it's an enemy, cheat by not requiring resources
|
||||||
entity.buildTime += Timers.delta() * speedMultiplier;
|
entity.buildTime += Timers.delta() * speedMultiplier;
|
||||||
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 1f, 0.05f);
|
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 1f, 0.05f);
|
||||||
|
|||||||
Reference in New Issue
Block a user