More payload block recolors / Bugfixes
BIN
core/assets-raw/sprites/blocks/payload/payload-loader-in.png
Normal file
|
After Width: | Height: | Size: 599 B |
BIN
core/assets-raw/sprites/blocks/payload/payload-loader-out.png
Normal file
|
After Width: | Height: | Size: 565 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
BIN
core/assets-raw/sprites/blocks/payload/payload-unloader-in.png
Normal file
|
After Width: | Height: | Size: 599 B |
BIN
core/assets-raw/sprites/blocks/payload/payload-unloader-out.png
Normal file
|
After Width: | Height: | Size: 565 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1020 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 2.0 KiB |
@@ -16,10 +16,9 @@ import mindustry.world.*;
|
|||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
import static mindustry.ai.Pathfinder.*;
|
import static mindustry.ai.Pathfinder.*;
|
||||||
|
|
||||||
//TODO I'm sure this class has countless problems
|
|
||||||
public class ControlPathfinder{
|
public class ControlPathfinder{
|
||||||
private static final long maxUpdate = Time.millisToNanos(20);
|
private static final long maxUpdate = Time.millisToNanos(20);
|
||||||
private static final int updateFPS = 50;
|
private static final int updateFPS = 60;
|
||||||
private static final int updateInterval = 1000 / updateFPS;
|
private static final int updateInterval = 1000 / updateFPS;
|
||||||
|
|
||||||
public static boolean showDebug = false;
|
public static boolean showDebug = false;
|
||||||
@@ -202,6 +201,7 @@ public class ControlPathfinder{
|
|||||||
for(int i = len - 1; i >= idx; i--){
|
for(int i = len - 1; i >= idx; i--){
|
||||||
Tile tile = tile(items[i]);
|
Tile tile = tile(items[i]);
|
||||||
float dst = unit.dst2(tile);
|
float dst = unit.dst2(tile);
|
||||||
|
//TODO maybe put this on a timer since raycasts can be expensive?
|
||||||
if(dst < minDst && !permissiveRaycast(pathType, tileX, tileY, tile.x, tile.y)){
|
if(dst < minDst && !permissiveRaycast(pathType, tileX, tileY, tile.x, tile.y)){
|
||||||
req.pathIndex = Math.max(dst <= range * range ? i + 1 : i, req.pathIndex);
|
req.pathIndex = Math.max(dst <= range * range ? i + 1 : i, req.pathIndex);
|
||||||
minDst = Math.min(dst, minDst);
|
minDst = Math.min(dst, minDst);
|
||||||
@@ -401,7 +401,6 @@ public class ControlPathfinder{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO each one of these could run in its own thread.
|
|
||||||
static class PathRequest{
|
static class PathRequest{
|
||||||
final PathfindThread thread;
|
final PathfindThread thread;
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ public class MissileAI extends AIController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTargeting(){
|
public boolean retarget(){
|
||||||
//no
|
//more frequent retarget due to high speed. TODO won't this lag?
|
||||||
|
return timer.get(timerTarget, 10f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ public class Blocks{
|
|||||||
droneCenter,
|
droneCenter,
|
||||||
|
|
||||||
//payloads
|
//payloads
|
||||||
payloadConveyor, payloadRouter, reinforcedPayloadConveyor, reinforcedPayloadRouter, payloadPropulsionTower, smallDeconstructor, deconstructor, constructor, largeConstructor, payloadLoader, payloadUnloader,
|
payloadConveyor, payloadRouter, reinforcedPayloadConveyor, reinforcedPayloadRouter, payloadMassDriver, payloadPropulsionTower, smallDeconstructor, deconstructor, constructor, largeConstructor, payloadLoader, payloadUnloader,
|
||||||
|
|
||||||
|
|
||||||
//logic
|
//logic
|
||||||
@@ -3575,6 +3575,18 @@ public class Blocks{
|
|||||||
canOverdrive = false;
|
canOverdrive = false;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
//TODO
|
||||||
|
if(false)
|
||||||
|
payloadMassDriver = new PayloadMassDriver("payload-mass-driver"){{
|
||||||
|
requirements(Category.units, with(Items.tungsten, 120, Items.silicon, 120, Items.oxide, 60));
|
||||||
|
size = 3;
|
||||||
|
reloadTime = 150f;
|
||||||
|
chargeTime = 120f;
|
||||||
|
range = 300f;
|
||||||
|
maxPayloadSize = 2.5f;
|
||||||
|
consumes.power(3f);
|
||||||
|
}};
|
||||||
|
|
||||||
payloadPropulsionTower = new PayloadMassDriver("payload-propulsion-tower"){{
|
payloadPropulsionTower = new PayloadMassDriver("payload-propulsion-tower"){{
|
||||||
requirements(Category.units, with(Items.thorium, 300, Items.silicon, 200, Items.plastanium, 200, Items.phaseFabric, 50));
|
requirements(Category.units, with(Items.thorium, 300, Items.silicon, 200, Items.plastanium, 200, Items.phaseFabric, 50));
|
||||||
size = 5;
|
size = 5;
|
||||||
@@ -3623,14 +3635,14 @@ public class Blocks{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
payloadLoader = new PayloadLoader("payload-loader"){{
|
payloadLoader = new PayloadLoader("payload-loader"){{
|
||||||
requirements(Category.units, with(Items.graphite, 50, Items.silicon, 50, Items.copper, 100));
|
requirements(Category.units, with(Items.graphite, 50, Items.silicon, 50, Items.tungsten, 80));
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
consumes.power(2f);
|
consumes.power(2f);
|
||||||
size = 3;
|
size = 3;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
payloadUnloader = new PayloadUnloader("payload-unloader"){{
|
payloadUnloader = new PayloadUnloader("payload-unloader"){{
|
||||||
requirements(Category.units, with(Items.graphite, 50, Items.silicon, 50, Items.copper, 100));
|
requirements(Category.units, with(Items.graphite, 50, Items.silicon, 50, Items.oxide, 30));
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
consumes.power(2f);
|
consumes.power(2f);
|
||||||
size = 3;
|
size = 3;
|
||||||
|
|||||||
@@ -3130,6 +3130,7 @@ public class UnitTypes{
|
|||||||
isCounted = false;
|
isCounted = false;
|
||||||
envDisabled = 0;
|
envDisabled = 0;
|
||||||
|
|
||||||
|
targetPriority = -2;
|
||||||
lowAltitude = false;
|
lowAltitude = false;
|
||||||
mineWalls = true;
|
mineWalls = true;
|
||||||
mineFloor = false;
|
mineFloor = false;
|
||||||
@@ -3186,6 +3187,7 @@ public class UnitTypes{
|
|||||||
isCounted = false;
|
isCounted = false;
|
||||||
envDisabled = 0;
|
envDisabled = 0;
|
||||||
|
|
||||||
|
targetPriority = -2;
|
||||||
lowAltitude = false;
|
lowAltitude = false;
|
||||||
mineWalls = true;
|
mineWalls = true;
|
||||||
mineFloor = false;
|
mineFloor = false;
|
||||||
@@ -3254,6 +3256,8 @@ public class UnitTypes{
|
|||||||
isCounted = false;
|
isCounted = false;
|
||||||
envDisabled = 0;
|
envDisabled = 0;
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
lowAltitude = false;
|
lowAltitude = false;
|
||||||
mineWalls = true;
|
mineWalls = true;
|
||||||
mineFloor = false;
|
mineFloor = false;
|
||||||
|
|||||||
@@ -271,14 +271,16 @@ public class Units{
|
|||||||
|
|
||||||
result = null;
|
result = null;
|
||||||
cdist = 0f;
|
cdist = 0f;
|
||||||
|
cpriority = -99999f;
|
||||||
|
|
||||||
nearbyEnemies(team, x - range, y - range, range*2f, range*2f, e -> {
|
nearbyEnemies(team, x - range, y - range, range*2f, range*2f, e -> {
|
||||||
if(e.dead() || !predicate.get(e) || e.team == Team.derelict || !e.type.targetable) return;
|
if(e.dead() || !predicate.get(e) || e.team == Team.derelict || !e.type.targetable) return;
|
||||||
|
|
||||||
float dst2 = e.dst2(x, y) - (e.hitSize * e.hitSize);
|
float dst2 = e.dst2(x, y) - (e.hitSize * e.hitSize);
|
||||||
if(dst2 < range*range && (result == null || dst2 < cdist)){
|
if(dst2 < range*range && (result == null || dst2 < cdist || e.type.targetPriority > cpriority) && e.type.targetPriority >= cpriority){
|
||||||
result = e;
|
result = e;
|
||||||
cdist = dst2;
|
cdist = dst2;
|
||||||
|
cpriority = e.type.targetPriority;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -297,7 +299,7 @@ public class Units{
|
|||||||
if(e.dead() || !predicate.get(e) || e.team == Team.derelict || !e.within(x, y, range + e.hitSize/2f) || !e.type.targetable) return;
|
if(e.dead() || !predicate.get(e) || e.team == Team.derelict || !e.within(x, y, range + e.hitSize/2f) || !e.type.targetable) return;
|
||||||
|
|
||||||
float cost = sort.cost(e, x, y);
|
float cost = sort.cost(e, x, y);
|
||||||
if((result == null || cost < cdist) && e.type.targetPriority >= cpriority){
|
if((result == null || cost < cdist || e.type.targetPriority > cpriority) && e.type.targetPriority >= cpriority){
|
||||||
result = e;
|
result = e;
|
||||||
cdist = cost;
|
cdist = cost;
|
||||||
cpriority = e.type.targetPriority;
|
cpriority = e.type.targetPriority;
|
||||||
|
|||||||
@@ -124,8 +124,13 @@ public class DesktopInput extends InputHandler{
|
|||||||
Position lineDest = ai.attackTarget != null ? ai.attackTarget : ai.targetPos;
|
Position lineDest = ai.attackTarget != null ? ai.attackTarget : ai.targetPos;
|
||||||
|
|
||||||
Tmp.v1.set(lineDest).sub(unit).setLength(unit.hitSize / 2f);
|
Tmp.v1.set(lineDest).sub(unit).setLength(unit.hitSize / 2f);
|
||||||
|
Tmp.v2.set(Tmp.v1).scl(-1f).setLength(3.5f);
|
||||||
|
|
||||||
Drawf.line(Pal.accent, unit.x + Tmp.v1.x, unit.y + Tmp.v1.y, lineDest.getX(), lineDest.getY());
|
Drawf.line(Pal.accent, unit.x + Tmp.v1.x, unit.y + Tmp.v1.y, lineDest.getX() + Tmp.v2.x, lineDest.getY() + Tmp.v2.y);
|
||||||
|
|
||||||
|
if(ai.attackTarget == null){
|
||||||
|
Drawf.square(lineDest.getX(), lineDest.getY(), 3.5f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Drawf.square(unit.x, unit.y, unit.hitSize / 1.4f + 1f);
|
Drawf.square(unit.x, unit.y, unit.hitSize / 1.4f + 1f);
|
||||||
|
|||||||