Better fix for #7854

This commit is contained in:
Anuken 2022-11-10 08:22:53 -05:00
parent 2e9026936e
commit 3fe38e8925
4 changed files with 9 additions and 4 deletions

View File

@ -303,7 +303,7 @@ public class ControlPathfinder{
if(net.client()) return;
//TODO currently capped at 6 threads, might be a good idea to make it more?
threads = new PathfindThread[Mathf.clamp(Runtime.getRuntime().availableProcessors() - 2, 1, 6)];
threads = new PathfindThread[Mathf.clamp(Runtime.getRuntime().availableProcessors() - 1, 1, 6)];
for(int i = 0; i < threads.length; i ++){
threads[i] = new PathfindThread("ControlPathfindThread-" + i);
threads[i].setPriority(Thread.MIN_PRIORITY);

View File

@ -352,6 +352,7 @@ public class Schematics implements Loadable{
/** Creates a schematic from a world selection. */
public Schematic create(int x, int y, int x2, int y2){
Team team = headless ? null : Vars.player.team();
NormalizeResult result = Placement.normalizeArea(x, y, x2, y2, 0, false, maxSchematicSize);
x = result.x;
y = result.y;
@ -367,7 +368,7 @@ public class Schematics implements Loadable{
for(int cx = x; cx <= x2; cx++){
for(int cy = y; cy <= y2; cy++){
Building linked = world.build(cx, cy);
if(linked != null && !linked.wasVisible) continue;
if(linked != null && (!linked.isDiscovered(team) || !linked.wasVisible)) continue;
Block realBlock = linked == null ? null : linked instanceof ConstructBuild cons ? cons.current : linked.block;
@ -398,6 +399,7 @@ public class Schematics implements Loadable{
for(int cx = ox; cx <= ox2; cx++){
for(int cy = oy; cy <= oy2; cy++){
Building tile = world.build(cx, cy);
if(tile != null && (!tile.isDiscovered(team) || !tile.wasVisible)) continue;
Block realBlock = tile == null ? null : tile instanceof ConstructBuild cons ? cons.current : tile.block;
if(tile != null && !counted.contains(tile.pos()) && realBlock != null

View File

@ -472,6 +472,10 @@ public class UnitType extends UnlockableContent{
return spawn(state.rules.defaultTeam, pos);
}
public Unit spawn(Position pos, Team team){
return spawn(team, pos);
}
public boolean hasWeapons(){
return weapons.size > 0;
}

View File

@ -8,8 +8,7 @@ import mindustry.world.blocks.heat.*;
import mindustry.world.meta.*;
/** A crafter that requires contact from heater blocks to craft. */
public class
HeatCrafter extends GenericCrafter{
public class HeatCrafter extends GenericCrafter{
/** Base heat requirement for 100% efficiency. */
public float heatRequirement = 10f;
/** After heat meets this requirement, excess heat will be scaled by this number. */