mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-09-22 13:01:12 +03:00
Merge branch 'master' of https://github.com/Anuken/Mindustry into v9
This commit is contained in:
@@ -164,6 +164,7 @@ public class ControlPathfinder implements Runnable{
|
||||
|
||||
//main thread only!
|
||||
long lastUpdateId = state.updateId;
|
||||
long lastRecomputeTime;
|
||||
|
||||
//both threads
|
||||
volatile boolean notFound = false;
|
||||
@@ -1176,7 +1177,9 @@ public class ControlPathfinder implements Runnable{
|
||||
long fieldKey = FieldIndex.get(destPos, costId, team);
|
||||
|
||||
//use existing request if it exists.
|
||||
if(request != null && request.destination == destPos){
|
||||
if(request != null && (request.destination == destPos ||
|
||||
//can only recompute path only twice a second, unless it's far away
|
||||
(Time.timeSinceMillis(request.lastRecomputeTime) < 1000 && Mathf.dst(destX, destY, request.destination % wwidth, request.destination / wwidth) <= 4f))){
|
||||
request.lastUpdateId = state.updateId;
|
||||
|
||||
Tile initialTileOn = tileOn;
|
||||
@@ -1297,6 +1300,7 @@ public class ControlPathfinder implements Runnable{
|
||||
unitRequests.put(unit, request = new PathRequest(unit, team, costId, destPos));
|
||||
|
||||
PathRequest f = request;
|
||||
request.lastRecomputeTime = Time.millis();
|
||||
|
||||
//on the pathfinding thread: initialize the request
|
||||
queue.post(() -> {
|
||||
|
||||
@@ -259,7 +259,8 @@ public class CommandAI extends AIController{
|
||||
targetPos = new Vec2();
|
||||
lastTargetPos = targetPos;
|
||||
}
|
||||
targetPos.set(attackTarget);
|
||||
//don't target where target dummies are right now, target their block
|
||||
targetPos.set(attackTarget instanceof TargetDummyUnit t && t.building != null ? t.building : attackTarget);
|
||||
|
||||
if(unit.isGrounded() && attackTarget instanceof Building build && build.tile.solid() && unit.type.pathCostId != ControlPathfinder.costIdLegs && !ramming){
|
||||
Tile best = build.findClosestEdge(unit, Tile::solid);
|
||||
|
||||
@@ -92,7 +92,7 @@ public class AvoidanceProcess implements AsyncProcess{
|
||||
float rad = Float.intBitsToFloat(items[i + 1]);
|
||||
float rad2 = rad * rad;
|
||||
|
||||
int r = Math.max(1, Mathf.ceil(rad));
|
||||
int r = Mathf.clamp(1, Mathf.ceil(rad), 20);
|
||||
|
||||
for(int dx = -r; dx <= r; dx++){
|
||||
for(int dy = -r; dy <= r; dy++){
|
||||
|
||||
@@ -11,6 +11,7 @@ import arc.util.*;
|
||||
import arc.util.Log.*;
|
||||
import mindustry.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.mod.data.*;
|
||||
|
||||
import java.io.*;
|
||||
@@ -106,6 +107,8 @@ public class DataImagePacker{
|
||||
|
||||
try{
|
||||
Pixmap pixmap = new Pixmap(cacheFile);
|
||||
Pixmaps.antialias(pixmap);
|
||||
Drawf.checkBleed(pixmap);
|
||||
//don't add the double dp prefix, only add it if it's not already present
|
||||
String name = (image.isGenerated() && image.name.contains("-dp-") ? "" : regionPrefix) + image.name;
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ import mindustry.world.meta.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class TargetDummy extends Block{
|
||||
static final float maxDummySize = 30f;
|
||||
|
||||
public final int dpsUpdateTime = timers++;
|
||||
public UnitType unitType = UnitTypes.dummy;
|
||||
public float pullScale = 0.33f;
|
||||
@@ -39,7 +41,6 @@ public class TargetDummy extends Block{
|
||||
targetable = false;
|
||||
allowedInPayloads = false;
|
||||
canOverdrive = false;
|
||||
|
||||
saveConfig = true;
|
||||
|
||||
config(int[].class, (TargetDummyBuild tile, int[] config) -> {
|
||||
@@ -47,9 +48,10 @@ public class TargetDummy extends Block{
|
||||
tile.unitTeam = tile.team;
|
||||
if(config[0] == 1) tile.unitTeam = Team.get(tile.dummyTeam());
|
||||
tile.boosting = config[1] == 1;
|
||||
tile.unitArmor = config[2];
|
||||
tile.unitArmor = Mathf.clamp(config[2], 0, 100_000);
|
||||
tile.resetTime = config[3];
|
||||
tile.dummySize = Float.intBitsToFloat(config[4]);
|
||||
tile.dummySize = Mathf.clamp(Float.intBitsToFloat(config[4]), 0.1f, maxDummySize * tilesize);
|
||||
if(Float.isNaN(tile.dummySize) || Float.isInfinite(tile.dummySize)) tile.dummySize = 8f;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -251,7 +253,7 @@ public class TargetDummy extends Block{
|
||||
t.field("" + (dummySize/tilesize), TextFieldFilter.floatsOnly, s -> configureInt(4, Float.floatToIntBits(Strings.parseFloat(s) * tilesize)))
|
||||
.valid(val -> {
|
||||
float parsed = Strings.parseFloat(val, Float.MAX_VALUE);
|
||||
return parsed >= 0.1f && parsed <= 50f;
|
||||
return parsed >= 0.1f && parsed <= maxDummySize;
|
||||
}).padLeft(8f).growX();
|
||||
t.add(StatUnit.blocks.localized()).padLeft(8f);
|
||||
}).top().grow().margin(8f);
|
||||
|
||||
@@ -43,6 +43,15 @@ public class ThermalGenerator extends PowerGenerator{
|
||||
lightClipSize = Math.max(lightClipSize, 45f * size * 2f * 2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPatch(){
|
||||
super.afterPatch();
|
||||
if(outputLiquid != null){
|
||||
outputsLiquid = true;
|
||||
hasLiquids = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
@@ -82,7 +91,7 @@ public class ThermalGenerator extends PowerGenerator{
|
||||
generateEffect.at(x + Mathf.range(3f), y + Mathf.range(3f));
|
||||
}
|
||||
|
||||
if(outputLiquid != null){
|
||||
if(outputLiquid != null && hasLiquids){
|
||||
float added = Math.min(productionEfficiency * delta() * outputLiquid.amount, liquidCapacity - liquids.get(outputLiquid.liquid));
|
||||
liquids.add(outputLiquid.liquid, added);
|
||||
dumpLiquid(outputLiquid.liquid);
|
||||
|
||||
Reference in New Issue
Block a user