mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-25 22:17:59 +07:00
Beam tower
This commit is contained in:
parent
ebf3e0fbd1
commit
5e249e50dd
@ -414,3 +414,4 @@
|
||||
63294=turbine-condenser|block-turbine-condenser-ui
|
||||
63293=beam-node|block-beam-node-ui
|
||||
63292=spark|unit-spark-ui
|
||||
63291=beam-tower|block-beam-tower-ui
|
||||
|
Binary file not shown.
@ -79,7 +79,7 @@ public class Blocks implements ContentList{
|
||||
combustionGenerator, thermalGenerator, steamGenerator, differentialGenerator, rtgGenerator, solarPanel, largeSolarPanel, thoriumReactor,
|
||||
turbineCondenser,
|
||||
impactReactor, battery, batteryLarge, powerNode, powerNodeLarge, surgeTower, diode,
|
||||
beamNode,
|
||||
beamNode, beamTower,
|
||||
|
||||
//production
|
||||
mechanicalDrill, pneumaticDrill, laserDrill, blastDrill, waterExtractor, oilExtractor, cultivator,
|
||||
@ -1404,9 +1404,20 @@ public class Blocks implements ContentList{
|
||||
|
||||
beamNode = new BeamNode("beam-node"){{
|
||||
requirements(Category.power, with(Items.graphite, 1, Items.lead, 3));
|
||||
consumesPower = outputsPower = true;
|
||||
consumes.powerBuffered(1000f);
|
||||
range = 10;
|
||||
}};
|
||||
|
||||
//TODO requirements
|
||||
beamTower = new BeamNode("beam-tower"){{
|
||||
requirements(Category.power, with(Items.graphite, 10, Items.lead, 30, Items.beryllium, 30));
|
||||
size = 3;
|
||||
consumesPower = outputsPower = true;
|
||||
consumes.powerBuffered(30000f);
|
||||
range = 22;
|
||||
}};
|
||||
|
||||
combustionGenerator = new BurnerGenerator("combustion-generator"){{
|
||||
requirements(Category.power, with(Items.copper, 25, Items.lead, 15));
|
||||
powerProduction = 1f;
|
||||
|
@ -54,11 +54,12 @@ public class BeamNode extends PowerBlock{
|
||||
@Override
|
||||
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||
for(int i = 0; i < 4; i++){
|
||||
int maxLen = range;
|
||||
int maxLen = range + size/2;
|
||||
Building dest = null;
|
||||
var dir = Geometry.d4[i];
|
||||
int dx = dir.x, dy = dir.y;
|
||||
for(int j = 1; j <= range; j++){
|
||||
int offset = size/2;
|
||||
for(int j = 1 + offset; j <= range + offset; j++){
|
||||
var other = world.build(x + j * dir.x, y + j * dir.y);
|
||||
if(other != null && other.block.hasPower && other.team == Vars.player.team()){
|
||||
maxLen = j;
|
||||
@ -68,8 +69,8 @@ public class BeamNode extends PowerBlock{
|
||||
}
|
||||
|
||||
Drawf.dashLine(Pal.placing,
|
||||
x * tilesize + dx * (tilesize / 2f + 2),
|
||||
y * tilesize + dy * (tilesize / 2f + 2),
|
||||
x * tilesize + dx * (tilesize * size / 2f + 2),
|
||||
y * tilesize + dy * (tilesize * size / 2f + 2),
|
||||
x * tilesize + dx * (maxLen) * tilesize,
|
||||
y * tilesize + dy * (maxLen) * tilesize
|
||||
);
|
||||
@ -111,13 +112,13 @@ public class BeamNode extends PowerBlock{
|
||||
float w = laserWidth + Mathf.absin(pulseScl, pulseMag);
|
||||
|
||||
for(int i = 0; i < 4; i ++){
|
||||
if(dests[i] != null && (links[i].block != block || links[i].id > id)){
|
||||
if(dests[i] != null && (!(links[i].block instanceof BeamNode) || (links[i].tileX() != tileX() && links[i].tileY() != tileY()) || links[i].id > id)){
|
||||
int dst = Math.max(Math.abs(dests[i].x - tile.x), Math.abs(dests[i].y - tile.y));
|
||||
//don't draw lasers for adjacent blocks
|
||||
if(dst > 1){
|
||||
if(dst > 1 + size/2){
|
||||
var point = Geometry.d4[i];
|
||||
float poff = tilesize/2f;
|
||||
Drawf.laser(team, laser, laserEnd, x + poff*point.x, y + poff*point.y, dests[i].worldx() - poff*point.x, dests[i].worldy() - poff*point.y, w);
|
||||
Drawf.laser(team, laser, laserEnd, x + poff*size*point.x, y + poff*size*point.y, dests[i].worldx() - poff*point.x, dests[i].worldy() - poff*point.y, w);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -137,8 +138,9 @@ public class BeamNode extends PowerBlock{
|
||||
var dir = Geometry.d4[i];
|
||||
links[i] = null;
|
||||
dests[i] = null;
|
||||
int offset = size/2;
|
||||
//find first block with power in range
|
||||
for(int j = 1; j <= range; j++){
|
||||
for(int j = 1 + offset; j <= range + offset; j++){
|
||||
var other = world.build(tile.x + j * dir.x, tile.y + j * dir.y);
|
||||
if(other != null && other.block.hasPower && other.team == team){
|
||||
links[i] = other;
|
||||
|
@ -24,4 +24,4 @@ android.useAndroidX=true
|
||||
#used for slow jitpack builds; TODO see if this actually works
|
||||
org.gradle.internal.http.socketTimeout=100000
|
||||
org.gradle.internal.http.connectionTimeout=100000
|
||||
archash=f1b1c17bf6385b607dad4af3c51ad88646c9e9ca
|
||||
archash=07d01125a25b789cc081249c469b91b5f65070dc
|
||||
|
Loading…
Reference in New Issue
Block a user