More payload block recolors / Bugfixes

This commit is contained in:
Anuken 2022-02-09 23:27:04 -05:00
parent 48b1266d19
commit 79dcfefd69
15 changed files with 34 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1,020 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Before After
Before After

View file

@ -16,10 +16,9 @@ import mindustry.world.*;
import static mindustry.Vars.*;
import static mindustry.ai.Pathfinder.*;
//TODO I'm sure this class has countless problems
public class ControlPathfinder{
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;
public static boolean showDebug = false;
@ -202,6 +201,7 @@ public class ControlPathfinder{
for(int i = len - 1; i >= idx; i--){
Tile tile = tile(items[i]);
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)){
req.pathIndex = Math.max(dst <= range * range ? i + 1 : i, req.pathIndex);
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{
final PathfindThread thread;

View file

@ -29,7 +29,8 @@ public class MissileAI extends AIController{
}
@Override
public void updateTargeting(){
//no
public boolean retarget(){
//more frequent retarget due to high speed. TODO won't this lag?
return timer.get(timerTarget, 10f);
}
}

View file

@ -145,7 +145,7 @@ public class Blocks{
droneCenter,
//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
@ -3575,6 +3575,18 @@ public class Blocks{
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"){{
requirements(Category.units, with(Items.thorium, 300, Items.silicon, 200, Items.plastanium, 200, Items.phaseFabric, 50));
size = 5;
@ -3623,14 +3635,14 @@ public class Blocks{
}};
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;
consumes.power(2f);
size = 3;
}};
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;
consumes.power(2f);
size = 3;

View file

@ -3130,6 +3130,7 @@ public class UnitTypes{
isCounted = false;
envDisabled = 0;
targetPriority = -2;
lowAltitude = false;
mineWalls = true;
mineFloor = false;
@ -3186,6 +3187,7 @@ public class UnitTypes{
isCounted = false;
envDisabled = 0;
targetPriority = -2;
lowAltitude = false;
mineWalls = true;
mineFloor = false;
@ -3254,6 +3256,8 @@ public class UnitTypes{
isCounted = false;
envDisabled = 0;
;
lowAltitude = false;
mineWalls = true;
mineFloor = false;

View file

@ -271,14 +271,16 @@ public class Units{
result = null;
cdist = 0f;
cpriority = -99999f;
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;
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;
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;
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;
cdist = cost;
cpriority = e.type.targetPriority;

View file

@ -124,8 +124,13 @@ public class DesktopInput extends InputHandler{
Position lineDest = ai.attackTarget != null ? ai.attackTarget : ai.targetPos;
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);