testing winMM
This commit is contained in:
@@ -48,7 +48,6 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
/** Maximum line length. */
|
/** Maximum line length. */
|
||||||
final static int maxLength = 100;
|
final static int maxLength = 100;
|
||||||
final static Rect r1 = new Rect(), r2 = new Rect();
|
final static Rect r1 = new Rect(), r2 = new Rect();
|
||||||
final static Seq<Point2> tmpPoints = new Seq<>(), tmpPoints2 = new Seq<>();
|
|
||||||
|
|
||||||
public final OverlayFragment frag = new OverlayFragment();
|
public final OverlayFragment frag = new OverlayFragment();
|
||||||
|
|
||||||
@@ -1144,7 +1143,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
diagonal = !diagonal;
|
diagonal = !diagonal;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(block instanceof PowerNode){
|
if(block != null && block.swapDiagonalPlacement){
|
||||||
diagonal = !diagonal;
|
diagonal = !diagonal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1161,39 +1160,8 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
points = Placement.normalizeLine(startX, startY, endX, endY);
|
points = Placement.normalizeLine(startX, startY, endX, endY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(block instanceof PowerNode node){
|
if(block != null){
|
||||||
var base = tmpPoints2;
|
block.changePlacementPath(points, rotation);
|
||||||
var result = tmpPoints.clear();
|
|
||||||
|
|
||||||
base.selectFrom(points, p -> p == points.first() || p == points.peek() || Build.validPlace(block, player.team(), p.x, p.y, rotation, false));
|
|
||||||
boolean addedLast = false;
|
|
||||||
|
|
||||||
outer:
|
|
||||||
for(int i = 0; i < base.size;){
|
|
||||||
var point = base.get(i);
|
|
||||||
result.add(point);
|
|
||||||
if(i == base.size - 1) addedLast = true;
|
|
||||||
|
|
||||||
//find the furthest node that overlaps this one
|
|
||||||
for(int j = base.size - 1; j > i; j--){
|
|
||||||
var other = base.get(j);
|
|
||||||
boolean over = node.overlaps(world.tile(point.x, point.y), world.tile(other.x, other.y));
|
|
||||||
|
|
||||||
if(over){
|
|
||||||
//add node to list and start searching for node that overlaps the next one
|
|
||||||
i = j;
|
|
||||||
continue outer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//if it got here, that means nothing was found. try to proceed to the next node anyway
|
|
||||||
i ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!addedLast) result.add(base.peek());
|
|
||||||
|
|
||||||
points.clear();
|
|
||||||
points.addAll(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float angle = Angles.angle(startX, startY, endX, endY);
|
float angle = Angles.angle(startX, startY, endX, endY);
|
||||||
|
|||||||
@@ -143,6 +143,8 @@ public class Block extends UnlockableContent{
|
|||||||
public boolean sync;
|
public boolean sync;
|
||||||
/** Whether this block uses conveyor-type placement mode. */
|
/** Whether this block uses conveyor-type placement mode. */
|
||||||
public boolean conveyorPlacement;
|
public boolean conveyorPlacement;
|
||||||
|
/** Whether to swap the diagonal placement modes. */
|
||||||
|
public boolean swapDiagonalPlacement;
|
||||||
/**
|
/**
|
||||||
* The color of this block when displayed on the minimap or map preview.
|
* The color of this block when displayed on the minimap or map preview.
|
||||||
* Do not set manually! This is overridden when loading for most blocks.
|
* Do not set manually! This is overridden when loading for most blocks.
|
||||||
@@ -386,6 +388,11 @@ public class Block extends UnlockableContent{
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Mutates the given list of points used during line placement. */
|
||||||
|
public void changePlacementPath(Seq<Point2> points, int rotation){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public Object nextConfig(){
|
public Object nextConfig(){
|
||||||
if(saveConfig && lastConfig != null){
|
if(saveConfig && lastConfig != null){
|
||||||
return lastConfig;
|
return lastConfig;
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ public class PowerNode extends PowerBlock{
|
|||||||
protected static boolean returnValue = false;
|
protected static boolean returnValue = false;
|
||||||
protected static BuildPlan otherReq;
|
protected static BuildPlan otherReq;
|
||||||
|
|
||||||
protected final ObjectSet<PowerGraph> graphs = new ObjectSet<>();
|
protected final static ObjectSet<PowerGraph> graphs = new ObjectSet<>();
|
||||||
|
protected final static Seq<Point2> tmpPoints = new Seq<>(), tmpPoints2 = new Seq<>();
|
||||||
|
|
||||||
public @Load("laser") TextureRegion laser;
|
public @Load("laser") TextureRegion laser;
|
||||||
public @Load("laser-end") TextureRegion laserEnd;
|
public @Load("laser-end") TextureRegion laserEnd;
|
||||||
@@ -40,6 +41,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
consumesPower = false;
|
consumesPower = false;
|
||||||
outputsPower = false;
|
outputsPower = false;
|
||||||
canOverdrive = false;
|
canOverdrive = false;
|
||||||
|
swapDiagonalPlacement = true;
|
||||||
|
|
||||||
config(Integer.class, (entity, value) -> {
|
config(Integer.class, (entity, value) -> {
|
||||||
PowerModule power = entity.power;
|
PowerModule power = entity.power;
|
||||||
@@ -149,6 +151,42 @@ public class PowerNode extends PowerBlock{
|
|||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void changePlacementPath(Seq<Point2> points, int rotation){
|
||||||
|
var base = tmpPoints2;
|
||||||
|
var result = tmpPoints.clear();
|
||||||
|
|
||||||
|
base.selectFrom(points, p -> p == points.first() || p == points.peek() || Build.validPlace(this, player.team(), p.x, p.y, rotation, false));
|
||||||
|
boolean addedLast = false;
|
||||||
|
|
||||||
|
outer:
|
||||||
|
for(int i = 0; i < base.size;){
|
||||||
|
var point = base.get(i);
|
||||||
|
result.add(point);
|
||||||
|
if(i == base.size - 1) addedLast = true;
|
||||||
|
|
||||||
|
//find the furthest node that overlaps this one
|
||||||
|
for(int j = base.size - 1; j > i; j--){
|
||||||
|
var other = base.get(j);
|
||||||
|
boolean over = overlaps(world.tile(point.x, point.y), world.tile(other.x, other.y));
|
||||||
|
|
||||||
|
if(over){
|
||||||
|
//add node to list and start searching for node that overlaps the next one
|
||||||
|
i = j;
|
||||||
|
continue outer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//if it got here, that means nothing was found. try to proceed to the next node anyway
|
||||||
|
i ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!addedLast) result.add(base.peek());
|
||||||
|
|
||||||
|
points.clear();
|
||||||
|
points.addAll(result);
|
||||||
|
}
|
||||||
|
|
||||||
protected void setupColor(float satisfaction){
|
protected void setupColor(float satisfaction){
|
||||||
float fract = 1f - satisfaction;
|
float fract = 1f - satisfaction;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user