🚧 Add insulator wall (#840)
* Stash insulator prototype
* Fix automatic wires when placing non-powernodes
* Implement requested changes
Stopping lightning has yet to be added.
* ❤️
* Implement lightning absorption
* Visually distinguish insulated power lines
* Stop lightning infront of wall
* Highlight insulators instead of recipients
* Attempt to implement requested changes
* Implement requested changes
* Remove spaces between if and (
* Snap lightning to insulated blocks
* Update bundle.properties
BIN
core/assets-raw/sprites/blocks/walls/insulator-wall-large.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
core/assets-raw/sprites/blocks/walls/insulator-wall.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
core/assets-raw/sprites/blocks/walls/plastanium-wall-large.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
core/assets-raw/sprites/blocks/walls/plastanium-wall.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
@ -853,6 +853,8 @@ block.copper-wall.name = Copper Wall
|
||||
block.copper-wall-large.name = Large Copper Wall
|
||||
block.titanium-wall.name = Titanium Wall
|
||||
block.titanium-wall-large.name = Large Titanium Wall
|
||||
block.plastanium-wall.name = Plastanium Wall
|
||||
block.plastanium-wall-large.name = Large Plastanium Wall
|
||||
block.phase-wall.name = Phase Wall
|
||||
block.phase-wall-large.name = Large Phase Wall
|
||||
block.thorium-wall.name = Thorium Wall
|
||||
@ -1076,6 +1078,8 @@ block.copper-wall.description = A cheap defensive block.\nUseful for protecting
|
||||
block.copper-wall-large.description = A cheap defensive block.\nUseful for protecting the core and turrets in the first few waves.\nSpans multiple tiles.
|
||||
block.titanium-wall.description = A moderately strong defensive block.\nProvides moderate protection from enemies.
|
||||
block.titanium-wall-large.description = A moderately strong defensive block.\nProvides moderate protection from enemies.\nSpans multiple tiles.
|
||||
block.plastanium-wall.description = A special type of wall that absorbs electric arcs and blocks automatic power node connections.
|
||||
block.plastanium-wall-large.description = A special type of wall that absorbs electric arcs and blocks automatic power node connections.\nSpans multiple tiles.
|
||||
block.thorium-wall.description = A strong defensive block.\nDecent protection from enemies.
|
||||
block.thorium-wall-large.description = A strong defensive block.\nDecent protection from enemies.\nSpans multiple tiles.
|
||||
block.phase-wall.description = A wall coated with special phase-based reflective compound. Deflects most bullets upon impact.
|
||||
|
@ -82,3 +82,4 @@ AzariasB
|
||||
amrsoll
|
||||
ねらひかだ
|
||||
Draco
|
||||
Quezler
|
||||
|
Before Width: | Height: | Size: 727 B After Width: | Height: | Size: 737 B |
Before Width: | Height: | Size: 719 KiB After Width: | Height: | Size: 930 KiB |
Before Width: | Height: | Size: 278 KiB After Width: | Height: | Size: 304 KiB |
Before Width: | Height: | Size: 259 KiB After Width: | Height: | Size: 1.0 MiB |
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 187 KiB |
Before Width: | Height: | Size: 882 KiB After Width: | Height: | Size: 331 KiB |
@ -52,7 +52,7 @@ public class Blocks implements ContentList{
|
||||
|
||||
//defense
|
||||
scrapWall, scrapWallLarge, scrapWallHuge, scrapWallGigantic, thruster, //ok, these names are getting ridiculous, but at least I don't have humongous walls yet
|
||||
copperWall, copperWallLarge, titaniumWall, titaniumWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge,
|
||||
copperWall, copperWallLarge, titaniumWall, titaniumWallLarge, plastaniumWall, plastaniumWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge,
|
||||
phaseWall, phaseWallLarge, surgeWall, surgeWallLarge, mender, mendProjector, overdriveProjector, forceProjector, shockMine,
|
||||
|
||||
//transport
|
||||
@ -795,6 +795,19 @@ public class Blocks implements ContentList{
|
||||
size = 2;
|
||||
}};
|
||||
|
||||
plastaniumWall = new Wall("plastanium-wall"){{
|
||||
requirements(Category.defense, ItemStack.with(Items.plastanium, 6, Items.metaglass, 2));
|
||||
health = 190 * wallHealthMultiplier;
|
||||
insulated = true;
|
||||
}};
|
||||
|
||||
plastaniumWallLarge = new Wall("plastanium-wall-large"){{
|
||||
requirements(Category.defense, ItemStack.mult(plastaniumWall.requirements, 4));
|
||||
health = 190 * wallHealthMultiplier * 4;
|
||||
size = 2;
|
||||
insulated = true;
|
||||
}};
|
||||
|
||||
thoriumWall = new Wall("thorium-wall"){{
|
||||
requirements(Category.defense, ItemStack.with(Items.thorium, 6));
|
||||
health = 200 * wallHealthMultiplier;
|
||||
|
@ -104,6 +104,11 @@ public class TechTree implements ContentList{
|
||||
node(door, () -> {
|
||||
node(doorLarge);
|
||||
});
|
||||
node(plastaniumWall, () -> {
|
||||
node(plastaniumWallLarge, () -> {
|
||||
|
||||
});
|
||||
});
|
||||
node(titaniumWallLarge);
|
||||
node(thoriumWall, () -> {
|
||||
node(thoriumWallLarge);
|
||||
|
@ -20,8 +20,9 @@ import io.anuke.mindustry.entities.type.Unit;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.graphics.Pal;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
import static io.anuke.mindustry.Vars.bulletGroup;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class Lightning extends TimedEntity implements DrawTrait, TimeTrait{
|
||||
public static final float lifetime = 10f;
|
||||
@ -34,7 +35,7 @@ public class Lightning extends TimedEntity implements DrawTrait, TimeTrait{
|
||||
private static final float hitRange = 30f;
|
||||
private static int lastSeed = 0;
|
||||
|
||||
private Array<Position> lines = new Array<>();
|
||||
private Array<Vector2> lines = new Array<>();
|
||||
private Color color = Pal.lancerLaser;
|
||||
|
||||
/** For pooling use only. Do not call directly! */
|
||||
@ -61,10 +62,30 @@ public class Lightning extends TimedEntity implements DrawTrait, TimeTrait{
|
||||
random.setSeed(seed);
|
||||
hit.clear();
|
||||
|
||||
boolean[] bhit = {false};
|
||||
|
||||
for(int i = 0; i < length / 2; i++){
|
||||
Bullet.create(Bullets.damageLightning, l, team, x, y, 0f, 1f, 1f, dmg);
|
||||
l.lines.add(new Vector2(x + Mathf.range(3f), y + Mathf.range(3f)));
|
||||
|
||||
if(l.lines.size > 1){
|
||||
bhit[0] = false;
|
||||
Position from = l.lines.get(l.lines.size - 2);
|
||||
Position to = l.lines.get(l.lines.size - 1);
|
||||
world.raycastEach(world.toTile(from.getX()), world.toTile(from.getY()), world.toTile(to.getX()), world.toTile(to.getY()), (wx, wy) -> {
|
||||
|
||||
Tile tile = world.ltile(wx, wy);
|
||||
if(tile != null && tile.block().insulated){
|
||||
bhit[0] = true;
|
||||
//snap it instead of removing
|
||||
l.lines.get(l.lines.size -1).set(wx * tilesize, wy * tilesize);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if(bhit[0]) break;
|
||||
}
|
||||
|
||||
rect.setSize(hitRange).setCenter(x, y);
|
||||
entities.clear();
|
||||
if(hit.size < maxChain){
|
||||
@ -83,6 +104,7 @@ public class Lightning extends TimedEntity implements DrawTrait, TimeTrait{
|
||||
y = furthest.y;
|
||||
}else{
|
||||
rotation += random.range(20f);
|
||||
|
||||
x += Angles.trnsx(rotation, hitRange / 2f);
|
||||
y += Angles.trnsy(rotation, hitRange / 2f);
|
||||
}
|
||||
|
@ -75,6 +75,8 @@ public class Pal{
|
||||
|
||||
surge = Color.valueOf("f3e979"),
|
||||
|
||||
plastanium = Color.valueOf("a1b46e"),
|
||||
|
||||
redSpark = Color.valueOf("fbb97f"),
|
||||
orangeSpark = Color.valueOf("d2b29c"),
|
||||
|
||||
|
@ -55,6 +55,8 @@ public class Block extends BlockStorage{
|
||||
public boolean breakable;
|
||||
/** whether this floor can be placed on. */
|
||||
public boolean placeableOn = true;
|
||||
/** whether this block has insulating properties. */
|
||||
public boolean insulated = false;
|
||||
/** tile entity health */
|
||||
public int health = -1;
|
||||
/** base block explosiveness */
|
||||
@ -313,7 +315,7 @@ public class Block extends BlockStorage{
|
||||
tempTiles.clear();
|
||||
Geometry.circle(tile.x, tile.y, range, (x, y) -> {
|
||||
Tile other = world.ltile(x, y);
|
||||
if(other != null && other.block instanceof PowerNode && ((PowerNode)other.block).linkValid(other, tile) && !other.entity.proximity().contains(tile) &&
|
||||
if(other != null && other.block instanceof PowerNode && ((PowerNode)other.block).linkValid(other, tile) && !PowerNode.insulated(other, tile) && !other.entity.proximity().contains(tile) &&
|
||||
!(outputsPower && tile.entity.proximity().contains(p -> p.entity != null && p.entity.power != null && p.entity.power.graph == other.entity.power.graph))){
|
||||
tempTiles.add(other);
|
||||
}
|
||||
|
@ -51,5 +51,4 @@ public class Wall extends Block{
|
||||
public boolean canReplace(Block other){
|
||||
return super.canReplace(other) && health > other.health;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -108,7 +108,9 @@ public class PowerNode extends PowerBlock{
|
||||
Geometry.circle(tile.x, tile.y, (int)(laserRange + 1), (x, y) -> {
|
||||
Tile other = world.ltile(x, y);
|
||||
if(valid.test(other)){
|
||||
tempTiles.add(other);
|
||||
if(!insulated(tile, other)) {
|
||||
tempTiles.add(other);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -233,7 +235,13 @@ public class PowerNode extends PowerBlock{
|
||||
Draw.color(Pal.placing);
|
||||
Drawf.circles(x * tilesize + offset(), y * tilesize + offset(), laserRange * tilesize);
|
||||
|
||||
getPotentialLinks(tile, other -> Drawf.square(other.drawx(), other.drawy(), other.block().size * tilesize / 2f + 2f, Pal.place));
|
||||
getPotentialLinks(tile, other -> {
|
||||
Drawf.square(other.drawx(), other.drawy(), other.block().size * tilesize / 2f + 2f, Pal.place);
|
||||
|
||||
insulators(tile.x, tile.y, other.x, other.y, cause -> {
|
||||
Drawf.square(cause.drawx(), cause.drawy(), cause.block().size * tilesize / 2f + 2f, Pal.plastanium);
|
||||
});
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
}
|
||||
@ -311,4 +319,27 @@ public class PowerNode extends PowerBlock{
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
public static boolean insulated(Tile tile, Tile other){
|
||||
return insulated(tile.x, tile.y, other.x, other.y);
|
||||
}
|
||||
|
||||
public static boolean insulated(int x, int y, int x2, int y2){
|
||||
final Boolean[] bool = {false};
|
||||
insulators(x, y, x2, y2, cause -> {
|
||||
bool[0] = true;
|
||||
});
|
||||
return bool[0];
|
||||
}
|
||||
|
||||
public static void insulators(int x, int y, int x2, int y2, Consumer<Tile> iterator){
|
||||
world.raycastEach(x, y, x2, y2, (wx, wy) -> {
|
||||
|
||||
Tile tile = world.ltile(wx, wy);
|
||||
if(tile != null && tile.block() != null && tile.block().insulated){
|
||||
iterator.accept(tile);
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|