Duct bridge input display
This commit is contained in:
@@ -372,10 +372,6 @@ public class Blocks implements ContentList{
|
|||||||
variants = 3;
|
variants = 3;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
//glowBlob = new Prop("glowblob"){{
|
|
||||||
// variants = 1;
|
|
||||||
//}};
|
|
||||||
|
|
||||||
boulder = new Prop("boulder"){{
|
boulder = new Prop("boulder"){{
|
||||||
variants = 2;
|
variants = 2;
|
||||||
stone.asFloor().decoration = this;
|
stone.asFloor().decoration = this;
|
||||||
|
|||||||
@@ -611,7 +611,7 @@ public class UnitTypes implements ContentList{
|
|||||||
|
|
||||||
bullet = new LiquidBulletType(Liquids.slag){{
|
bullet = new LiquidBulletType(Liquids.slag){{
|
||||||
damage = 11;
|
damage = 11;
|
||||||
speed = 2.3f;
|
speed = 2.4f;
|
||||||
drag = 0.01f;
|
drag = 0.01f;
|
||||||
shootEffect = Fx.shootSmall;
|
shootEffect = Fx.shootSmall;
|
||||||
lifetime = 56f;
|
lifetime = 56f;
|
||||||
|
|||||||
@@ -79,16 +79,14 @@ public class DuctBridge extends Block{
|
|||||||
Placement.calculateNodes(points, this, rotation, (point, other) -> Math.max(Math.abs(point.x - other.x), Math.abs(point.y - other.y)) <= range);
|
Placement.calculateNodes(points, this, rotation, (point, other) -> Math.max(Math.abs(point.x - other.x), Math.abs(point.y - other.y)) <= range);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void drawPlace(int x, int y, int rotation, boolean valid, boolean line){
|
||||||
public void drawPlace(int x, int y, int rotation, boolean valid){
|
|
||||||
super.drawPlace(x, y, rotation, valid);
|
|
||||||
|
|
||||||
int length = range;
|
int length = range;
|
||||||
Building found = null;
|
Building found = null;
|
||||||
|
int dx = Geometry.d4x(rotation), dy = Geometry.d4y(rotation);
|
||||||
|
|
||||||
//find the link
|
//find the link
|
||||||
for(int i = 1; i <= range; i++){
|
for(int i = 1; i <= range; i++){
|
||||||
Tile other = world.tile(x + Geometry.d4x(rotation) * i, y + Geometry.d4y(rotation) * i);
|
Tile other = world.tile(x + dx * i, y + dy * i);
|
||||||
|
|
||||||
if(other != null && other.build instanceof DuctBridgeBuild build && build.team == player.team()){
|
if(other != null && other.build instanceof DuctBridgeBuild build && build.team == player.team()){
|
||||||
length = i;
|
length = i;
|
||||||
@@ -97,17 +95,29 @@ public class DuctBridge extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Drawf.dashLine(Pal.placing,
|
if(line || found != null){
|
||||||
x * tilesize + Geometry.d4[rotation].x * (tilesize / 2f + 2),
|
Drawf.dashLine(Pal.placing,
|
||||||
y * tilesize + Geometry.d4[rotation].y * (tilesize / 2f + 2),
|
x * tilesize + dx * (tilesize / 2f + 2),
|
||||||
x * tilesize + Geometry.d4[rotation].x * (length) * tilesize,
|
y * tilesize + dy * (tilesize / 2f + 2),
|
||||||
y * tilesize + Geometry.d4[rotation].y * (length) * tilesize
|
x * tilesize + dx * (length) * tilesize,
|
||||||
);
|
y * tilesize + dy * (length) * tilesize
|
||||||
|
);
|
||||||
if(found != null){
|
|
||||||
Drawf.square(found.x, found.y, found.block.size * tilesize/2f + 2.5f, 0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(found != null){
|
||||||
|
if(line){
|
||||||
|
Drawf.square(found.x, found.y, found.block.size * tilesize/2f + 2.5f, 0f);
|
||||||
|
}else{
|
||||||
|
Drawf.square(found.x, found.y, 2f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||||
|
super.drawPlace(x, y, rotation, valid);
|
||||||
|
|
||||||
|
drawPlace(x, y, rotation, valid, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawBridge(int rotation, float x1, float y1, float x2, float y2){
|
public void drawBridge(int rotation, float x1, float y1, float x2, float y2){
|
||||||
@@ -156,6 +166,41 @@ public class DuctBridge extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawSelect(){
|
||||||
|
drawPlace(tile.x, tile.y, rotation, true, false);
|
||||||
|
//draw incoming bridges
|
||||||
|
for(int dir = 0; dir < 4; dir++){
|
||||||
|
if(dir != rotation){
|
||||||
|
int dx = Geometry.d4x(dir), dy = Geometry.d4y(dir);
|
||||||
|
int length = range;
|
||||||
|
Building found = null;
|
||||||
|
|
||||||
|
//find the link
|
||||||
|
for(int i = 1; i <= range; i++){
|
||||||
|
Tile other = world.tile(tile.x + dx * i, tile.y + dy * i);
|
||||||
|
|
||||||
|
if(other != null && other.build instanceof DuctBridgeBuild build && build.team == player.team() && (build.rotation + 2) % 4 == dir){
|
||||||
|
length = i;
|
||||||
|
found = other.build;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(found != null){
|
||||||
|
Drawf.dashLine(Pal.place,
|
||||||
|
found.x - dx * (tilesize / 2f + 2),
|
||||||
|
found.y - dy * (tilesize / 2f + 2),
|
||||||
|
found.x - dx * (length) * tilesize,
|
||||||
|
found.y - dy * (length) * tilesize
|
||||||
|
);
|
||||||
|
|
||||||
|
Drawf.square(found.x, found.y, 2f, 45f, Pal.place);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public DuctBridgeBuild findLink(){
|
public DuctBridgeBuild findLink(){
|
||||||
for(int i = 1; i <= range; i++){
|
for(int i = 1; i <= range; i++){
|
||||||
|
|||||||
Reference in New Issue
Block a user