Regen projector 'done'
This commit is contained in:
BIN
core/assets-raw/sprites/blocks/defense/regen-projector-mid.png
Normal file
BIN
core/assets-raw/sprites/blocks/defense/regen-projector-mid.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 791 B |
Binary file not shown.
|
Before Width: | Height: | Size: 7.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 760 B |
Binary file not shown.
|
Before Width: | Height: | Size: 756 B |
Binary file not shown.
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.9 KiB |
@@ -236,6 +236,29 @@ public class BlockIndexer{
|
|||||||
return size > 0;
|
return size > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Does not work with null teams. */
|
||||||
|
public boolean eachBlock(Team team, Rect rect, Boolf<Building> pred, Cons<Building> cons){
|
||||||
|
breturnArray.clear();
|
||||||
|
|
||||||
|
var buildings = team.data().buildings;
|
||||||
|
if(buildings == null) return false;
|
||||||
|
buildings.intersect(rect, b -> {
|
||||||
|
if(pred.get(b)){
|
||||||
|
breturnArray.add(b);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
int size = breturnArray.size;
|
||||||
|
var items = breturnArray.items;
|
||||||
|
for(int i = 0; i < size; i++){
|
||||||
|
cons.get(items[i]);
|
||||||
|
items[i] = null;
|
||||||
|
}
|
||||||
|
breturnArray.size = 0;
|
||||||
|
|
||||||
|
return size > 0;
|
||||||
|
}
|
||||||
|
|
||||||
/** Get all enemy blocks with a flag. */
|
/** Get all enemy blocks with a flag. */
|
||||||
public Seq<Building> getEnemy(Team team, BlockFlag type){
|
public Seq<Building> getEnemy(Team team, BlockFlag type){
|
||||||
breturnArray.clear();
|
breturnArray.clear();
|
||||||
|
|||||||
@@ -1527,7 +1527,7 @@ public class Blocks{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
buildTower = new BuildTurret("build-tower"){{
|
buildTower = new BuildTurret("build-tower"){{
|
||||||
requirements(Category.effect, with(Items.silicon, 60, Items.tungsten, 60, Items.oxide, 40));
|
requirements(Category.effect, with(Items.silicon, 80, Items.carbide, 30, Items.oxide, 40, Items.thorium, 30));
|
||||||
outlineColor = Pal.darkOutline;
|
outlineColor = Pal.darkOutline;
|
||||||
consumes.power(3f);
|
consumes.power(3f);
|
||||||
range = 150f;
|
range = 150f;
|
||||||
@@ -1538,21 +1538,25 @@ public class Blocks{
|
|||||||
//TODO green looks bad switch to orange
|
//TODO green looks bad switch to orange
|
||||||
//TODO orange also looks bad hhhh
|
//TODO orange also looks bad hhhh
|
||||||
regenProjector = new RegenProjector("regen-projector"){{
|
regenProjector = new RegenProjector("regen-projector"){{
|
||||||
requirements(Category.effect, with(Items.silicon, 60, Items.tungsten, 60, Items.oxide, 40));
|
requirements(Category.effect, with(Items.silicon, 60, Items.tungsten, 60, Items.oxide, 30));
|
||||||
size = 3;
|
size = 3;
|
||||||
consumes.power(1f);
|
consumes.power(1f);
|
||||||
rangeWidth = 6;
|
range = 28;
|
||||||
rangeLength = 22;
|
|
||||||
|
|
||||||
consumes.liquid(Liquids.hydrogen, 1f / 60f);
|
consumes.liquid(Liquids.hydrogen, 1f / 60f);
|
||||||
|
|
||||||
healPercent = 4f / 60f;
|
healPercent = 4f / 60f;
|
||||||
|
|
||||||
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidTile(Liquids.hydrogen, 9f / 4f), new DrawSideRegion(true), new DrawGlowRegion(){{
|
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidTile(Liquids.hydrogen, 9f / 4f), new DrawBlock(), new DrawGlowRegion(){{
|
||||||
//color = Color.valueOf("1eff21");
|
color = Color.orange;//Color.valueOf("1eff21");
|
||||||
}}, new DrawGlowRegion(true){{
|
}}, new DrawPulseShape(false){{
|
||||||
suffix = "-side-glow";
|
//radiusScl = 0.95f;
|
||||||
alpha = 1f;
|
layer = Layer.effect;
|
||||||
|
}}, new DrawShape(){{
|
||||||
|
layer = Layer.effect;
|
||||||
|
radius = 3.5f;
|
||||||
|
useWarmupRadius = true;
|
||||||
|
timeScl = 2f;
|
||||||
}});
|
}});
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|||||||
@@ -69,10 +69,12 @@ public class ErekirTechTree{
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO more tiers of build tower or "support" structures like overdrive projectors
|
|
||||||
//TODO method of repairing blocks of damage
|
|
||||||
node(buildTower, () -> {
|
|
||||||
|
|
||||||
|
node(regenProjector, () -> {
|
||||||
|
//TODO more tiers of build tower or "support" structures like overdrive projectors
|
||||||
|
node(buildTower, () -> {
|
||||||
|
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ public class SpawnGroup implements JsonSerializable, Cloneable{
|
|||||||
public int unitAmount = 1;
|
public int unitAmount = 1;
|
||||||
/** If not -1, the unit will only spawn in spawnpoints with these packed coordinates. */
|
/** If not -1, the unit will only spawn in spawnpoints with these packed coordinates. */
|
||||||
public int spawn = -1;
|
public int spawn = -1;
|
||||||
|
/** Fraction of health that unit is spawned with. */
|
||||||
|
public float healthFraction = 1f;
|
||||||
/** Seq of payloads that this unit will spawn with. */
|
/** Seq of payloads that this unit will spawn with. */
|
||||||
public @Nullable Seq<UnitType> payloads;
|
public @Nullable Seq<UnitType> payloads;
|
||||||
/** Status effect applied to the spawned unit. Null to disable. */
|
/** Status effect applied to the spawned unit. Null to disable. */
|
||||||
@@ -91,6 +93,7 @@ public class SpawnGroup implements JsonSerializable, Cloneable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
unit.shield = getShield(wave);
|
unit.shield = getShield(wave);
|
||||||
|
unit.health = unit.maxHealth * healthFraction;
|
||||||
|
|
||||||
//load up spawn payloads
|
//load up spawn payloads
|
||||||
if(payloads != null && unit instanceof Payloadc pay){
|
if(payloads != null && unit instanceof Payloadc pay){
|
||||||
@@ -118,6 +121,7 @@ public class SpawnGroup implements JsonSerializable, Cloneable{
|
|||||||
if(unitAmount != 1) json.writeValue("amount", unitAmount);
|
if(unitAmount != 1) json.writeValue("amount", unitAmount);
|
||||||
if(effect != null) json.writeValue("effect", effect.name);
|
if(effect != null) json.writeValue("effect", effect.name);
|
||||||
if(spawn != -1) json.writeValue("spawn", spawn);
|
if(spawn != -1) json.writeValue("spawn", spawn);
|
||||||
|
if(healthFraction != 1f) json.writeValue("healthFraction", healthFraction);
|
||||||
if(payloads != null && payloads.size > 0){
|
if(payloads != null && payloads.size > 0){
|
||||||
json.writeValue("payloads", payloads.map(u -> u.name).toArray(String.class));
|
json.writeValue("payloads", payloads.map(u -> u.name).toArray(String.class));
|
||||||
}
|
}
|
||||||
@@ -138,6 +142,7 @@ public class SpawnGroup implements JsonSerializable, Cloneable{
|
|||||||
shieldScaling = data.getFloat("shieldScaling", 0);
|
shieldScaling = data.getFloat("shieldScaling", 0);
|
||||||
unitAmount = data.getInt("amount", 1);
|
unitAmount = data.getInt("amount", 1);
|
||||||
spawn = data.getInt("spawn", -1);
|
spawn = data.getInt("spawn", -1);
|
||||||
|
healthFraction = data.getFloat("healthFraction", 1f);
|
||||||
if(data.has("payloads")){
|
if(data.has("payloads")){
|
||||||
payloads = Seq.with(json.readValue(String[].class, data.get("payloads"))).map(s -> content.getByName(ContentType.unit, s));
|
payloads = Seq.with(json.readValue(String[].class, data.get("payloads"))).map(s -> content.getByName(ContentType.unit, s));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -255,12 +255,13 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
state.rules.waves = true;
|
state.rules.waves = true;
|
||||||
state.rules.showSpawns = true;
|
state.rules.showSpawns = true;
|
||||||
state.rules.waveTimer = true;
|
state.rules.waveTimer = true;
|
||||||
state.rules.waveSpacing = 60f * 60f * 15f;
|
state.rules.waveSpacing = 60f * 60f * 7.5f;
|
||||||
state.rules.spawns = Seq.with(new SpawnGroup(){{
|
state.rules.spawns = Seq.with(new SpawnGroup(){{
|
||||||
type = UnitTypes.vanquish;
|
type = UnitTypes.vanquish;
|
||||||
spacing = 1;
|
spacing = 1;
|
||||||
shieldScaling = 60;
|
shieldScaling = 60;
|
||||||
unitScaling = 2f;
|
unitScaling = 2f;
|
||||||
|
healthFraction = 0.2f;
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class Liquid extends UnlockableContent{
|
|||||||
|
|
||||||
protected static final Rand rand = new Rand();
|
protected static final Rand rand = new Rand();
|
||||||
|
|
||||||
/** TODO If true, this fluid is treated as a gas (and does not create puddles) */
|
/** If true, this fluid is treated as a gas (and does not create puddles) */
|
||||||
public boolean gas = false;
|
public boolean gas = false;
|
||||||
/** Color used in pipes and on the ground. */
|
/** Color used in pipes and on the ground. */
|
||||||
public Color color;
|
public Color color;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package mindustry.world.blocks.defense;
|
|||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.math.geom.*;
|
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
@@ -23,27 +22,19 @@ public class RegenProjector extends Block{
|
|||||||
private static final IntFloatMap mendMap = new IntFloatMap();
|
private static final IntFloatMap mendMap = new IntFloatMap();
|
||||||
private static long lastUpdateFrame = -1;
|
private static long lastUpdateFrame = -1;
|
||||||
|
|
||||||
//cached points per-block for drawing convenience
|
public int range = 14;
|
||||||
protected @Nullable Vec2[] drawPoints;
|
|
||||||
|
|
||||||
public int rangeLength = 14, rangeWidth = 5;
|
|
||||||
//per frame
|
//per frame
|
||||||
public float healPercent = 12f / 60f;
|
public float healPercent = 12f / 60f;
|
||||||
|
|
||||||
public DrawBlock drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawSideRegion(true));
|
public DrawBlock drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawSideRegion(true));
|
||||||
|
|
||||||
public float effectChance = 0.011f;
|
public float effectChance = 0.013f;
|
||||||
public Effect effect = Fx.regenParticle;
|
public Effect effect = Fx.regenParticle;
|
||||||
|
|
||||||
public float beamSpacing = 60f * 7f, beamWidening = 5f, beamLenScl = 1.2f, beamStroke = 2f;
|
|
||||||
public Interp beamInterp = Interp.pow2Out;
|
|
||||||
public int beams = 6;
|
|
||||||
|
|
||||||
public RegenProjector(String name){
|
public RegenProjector(String name){
|
||||||
super(name);
|
super(name);
|
||||||
solid = true;
|
solid = true;
|
||||||
update = true;
|
update = true;
|
||||||
rotate = true;
|
|
||||||
group = BlockGroup.projectors;
|
group = BlockGroup.projectors;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
@@ -56,28 +47,7 @@ public class RegenProjector extends Block{
|
|||||||
public void drawPlace(int x, int y, int rotation, boolean valid){
|
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||||
super.drawPlace(x, y, rotation, valid);
|
super.drawPlace(x, y, rotation, valid);
|
||||||
|
|
||||||
drawBounds(x * tilesize + offset, y * tilesize + offset, rotation);
|
Drawf.dashSquare(Pal.accent, x, y, range * tilesize);
|
||||||
}
|
|
||||||
|
|
||||||
public void drawBounds(float x, float y, int rotation){
|
|
||||||
if(drawPoints == null){
|
|
||||||
drawPoints = new Vec2[]{
|
|
||||||
new Vec2(1f, -rangeWidth),
|
|
||||||
new Vec2(1f + rangeLength, -rangeWidth),
|
|
||||||
new Vec2(1f + rangeLength, rangeWidth),
|
|
||||||
new Vec2(1f + 0f, rangeWidth),
|
|
||||||
};
|
|
||||||
for(var v : drawPoints){
|
|
||||||
v.scl(tilesize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = 0; i < 4; i++){
|
|
||||||
Tmp.v1.set(drawPoints[i]).rotate(rotation * 90).add(x, y);
|
|
||||||
Tmp.v2.set(drawPoints[(i + 1) % 4]).rotate(rotation * 90).add(x, y);
|
|
||||||
|
|
||||||
Drawf.dashLine(Pal.accent, Tmp.v1.x, Tmp.v1.y, Tmp.v2.x, Tmp.v2.y);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -105,25 +75,12 @@ public class RegenProjector extends Block{
|
|||||||
public Seq<Building> targets = new Seq<>();
|
public Seq<Building> targets = new Seq<>();
|
||||||
public int lastChange = -2;
|
public int lastChange = -2;
|
||||||
public float warmup, totalTime;
|
public float warmup, totalTime;
|
||||||
|
public boolean didRegen = false;
|
||||||
|
|
||||||
public void updateTargets(){
|
public void updateTargets(){
|
||||||
targets.clear();
|
targets.clear();
|
||||||
taken.clear();
|
taken.clear();
|
||||||
float rot = rotation * 90;
|
indexer.eachBlock(team, Tmp.r1.setCentered(x, y, range * tilesize), b -> true, targets::add);
|
||||||
|
|
||||||
for(int cy = -rangeWidth; cy <= rangeWidth; cy++){
|
|
||||||
for(int cx = 1; cx <= rangeLength + 1; cx++){
|
|
||||||
|
|
||||||
//TODO handle offset
|
|
||||||
float wx = x/tilesize + Angles.trnsx(rot, cx, cy), wy = y/tilesize + Angles.trnsy(rot, cx, cy);
|
|
||||||
|
|
||||||
Building build = world.build((int)wx, (int)wy);
|
|
||||||
|
|
||||||
if(build != null && build.team == team && taken.add(build.id)){
|
|
||||||
targets.add(build);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -133,14 +90,18 @@ public class RegenProjector extends Block{
|
|||||||
updateTargets();
|
updateTargets();
|
||||||
}
|
}
|
||||||
|
|
||||||
warmup = Mathf.approachDelta(warmup, consValid() ? 1f : 0f, 1f / 70f);
|
//TODO should warmup depend on didRegen?
|
||||||
|
warmup = Mathf.approachDelta(warmup, consValid() && didRegen ? 1f : 0f, 1f / 70f);
|
||||||
totalTime += warmup * Time.delta;
|
totalTime += warmup * Time.delta;
|
||||||
|
didRegen = false;
|
||||||
|
|
||||||
if(consValid()){
|
if(consValid()){
|
||||||
//use Math.max to prevent stacking
|
//use Math.max to prevent stacking
|
||||||
for(Building build : targets){
|
for(Building build : targets){
|
||||||
if(!build.damaged()) continue;
|
if(!build.damaged()) continue;
|
||||||
|
|
||||||
|
didRegen = true;
|
||||||
|
|
||||||
int pos = build.pos();
|
int pos = build.pos();
|
||||||
//TODO periodic effect
|
//TODO periodic effect
|
||||||
float value = mendMap.get(pos);
|
float value = mendMap.get(pos);
|
||||||
@@ -165,10 +126,19 @@ public class RegenProjector extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean productionValid(){
|
||||||
|
return didRegen;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawSelect(){
|
public void drawSelect(){
|
||||||
super.drawSelect();
|
super.drawSelect();
|
||||||
drawBounds(x, y, rotation);
|
|
||||||
|
Drawf.dashSquare(Pal.accent, x, y, range * tilesize);
|
||||||
|
for(var target : targets){
|
||||||
|
Drawf.selected(target, Pal.accent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -184,26 +154,6 @@ public class RegenProjector extends Block{
|
|||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
drawer.drawBase(this);
|
drawer.drawBase(this);
|
||||||
|
|
||||||
for(int i = 0; i < beams; i++){
|
|
||||||
float life = beamInterp.apply((totalTime / beamSpacing + i / (float)beams) % 1f);
|
|
||||||
float len = life * rangeLength*beamLenScl * tilesize + size * tilesize/2f;
|
|
||||||
float width = Math.min(life * rangeWidth * 2f * tilesize * beamWidening, rangeWidth * 2f * tilesize);
|
|
||||||
float stroke = (0.5f + beamStroke * life) * warmup;
|
|
||||||
Draw.z(Layer.effect);
|
|
||||||
|
|
||||||
Lines.stroke(stroke, Pal.accent);
|
|
||||||
Draw.alpha(1f - Mathf.curve(life, 0.5f));
|
|
||||||
Lines.lineAngleCenter(
|
|
||||||
x + Angles.trnsx(rotdeg(), len),
|
|
||||||
y + Angles.trnsy(rotdeg(), len),
|
|
||||||
rotdeg() + 90f,
|
|
||||||
width
|
|
||||||
);
|
|
||||||
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -32,6 +32,11 @@ public class DrawGlowRegion extends DrawBlock{
|
|||||||
this.rotate = rotate;
|
this.rotate = rotate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public DrawGlowRegion(String suffix){
|
||||||
|
this.suffix = suffix;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBase(Building build){
|
public void drawBase(Building build){
|
||||||
if(build.warmup() <= 0.001f) return;
|
if(build.warmup() <= 0.001f) return;
|
||||||
|
|||||||
11
core/src/mindustry/world/draw/DrawPartial.java
Normal file
11
core/src/mindustry/world/draw/DrawPartial.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package mindustry.world.draw;
|
||||||
|
|
||||||
|
import arc.util.*;
|
||||||
|
import mindustry.entities.units.*;
|
||||||
|
import mindustry.world.*;
|
||||||
|
|
||||||
|
public abstract class DrawPartial extends DrawBlock{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawPlan(Block block, BuildPlan plan, Eachable<BuildPlan> list){}
|
||||||
|
}
|
||||||
55
core/src/mindustry/world/draw/DrawPulseShape.java
Normal file
55
core/src/mindustry/world/draw/DrawPulseShape.java
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
package mindustry.world.draw;
|
||||||
|
|
||||||
|
import arc.graphics.*;
|
||||||
|
import arc.graphics.g2d.*;
|
||||||
|
import arc.math.*;
|
||||||
|
import arc.math.geom.*;
|
||||||
|
import arc.util.*;
|
||||||
|
import mindustry.gen.*;
|
||||||
|
import mindustry.graphics.*;
|
||||||
|
|
||||||
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
|
public class DrawPulseShape extends DrawPartial{
|
||||||
|
public Color color = Pal.accent.cpy();
|
||||||
|
public float stroke = 2f, timeScl = 100f, minStroke = 0.2f;
|
||||||
|
public float radiusScl = 1f;
|
||||||
|
public float layer = -1f;
|
||||||
|
public boolean square = true;
|
||||||
|
|
||||||
|
public DrawPulseShape(boolean square){
|
||||||
|
this.square = square;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DrawPulseShape(){
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBase(Building build){
|
||||||
|
float pz = Draw.z();
|
||||||
|
if(layer > 0) Draw.z(layer);
|
||||||
|
|
||||||
|
float f = 1f - (Time.time / timeScl) % 1f;
|
||||||
|
float rad = build.block.size * tilesize / 2f * radiusScl;
|
||||||
|
|
||||||
|
Draw.color(color);
|
||||||
|
Lines.stroke((stroke * f + minStroke) * build.warmup());
|
||||||
|
|
||||||
|
if(square){
|
||||||
|
Lines.square(build.x, build.y, Math.min(1f + (1f - f) * rad, rad));
|
||||||
|
}else{
|
||||||
|
float r = Math.max(0f, Mathf.clamp(2f - f * 2f) * rad - f - 0.2f), w = Mathf.clamp(0.5f - f) * rad * 2f;
|
||||||
|
Lines.beginLine();
|
||||||
|
for(int i = 0; i < 4; i++){
|
||||||
|
Lines.linePoint(build.x + Geometry.d4(i).x * r + Geometry.d4(i).y * w, build.y + Geometry.d4(i).y * r - Geometry.d4(i).x * w);
|
||||||
|
if(f < 0.5f) Lines.linePoint(build.x + Geometry.d4(i).x * r - Geometry.d4(i).y * w, build.y + Geometry.d4(i).y * r + Geometry.d4(i).x * w);
|
||||||
|
}
|
||||||
|
Lines.endLine(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Draw.reset();
|
||||||
|
Draw.z(pz);
|
||||||
|
}
|
||||||
|
}
|
||||||
25
core/src/mindustry/world/draw/DrawShape.java
Normal file
25
core/src/mindustry/world/draw/DrawShape.java
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package mindustry.world.draw;
|
||||||
|
|
||||||
|
import arc.graphics.*;
|
||||||
|
import arc.graphics.g2d.*;
|
||||||
|
import mindustry.gen.*;
|
||||||
|
import mindustry.graphics.*;
|
||||||
|
|
||||||
|
public class DrawShape extends DrawPartial{
|
||||||
|
public Color color = Pal.accent.cpy();
|
||||||
|
public int sides = 4;
|
||||||
|
public float radius = 2f, timeScl = 1f, layer = -1f, x, y;
|
||||||
|
public boolean useWarmupRadius = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBase(Building build){
|
||||||
|
float pz = Draw.z();
|
||||||
|
if(layer > 0) Draw.z(layer);
|
||||||
|
|
||||||
|
Draw.color(color);
|
||||||
|
Fill.poly(build.x + x, build.y + y, sides, useWarmupRadius ? radius * build.warmup() : radius, build.totalProgress() * timeScl);
|
||||||
|
|
||||||
|
Draw.reset();
|
||||||
|
Draw.z(pz);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user