Phase synthesizer implementation

This commit is contained in:
Anuken 2021-11-22 22:34:22 -05:00
parent d7adacd932
commit 3a9fdc8b3d
11 changed files with 100 additions and 19 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

View File

@ -1131,7 +1131,7 @@ public class Blocks implements ContentList{
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidRegion(Liquids.hydrogen), new DrawBlock(), new DrawRegion("-top"), new DrawHeatInput(),
new DrawParticlesIn(){{
color = Color.valueOf("bfe9ff");
color = Color.valueOf("d4f0ff");
alpha = 0.6f;
particleSize = 4f;
particles = 10;
@ -1159,31 +1159,31 @@ public class Blocks implements ContentList{
size = 3;
itemCapacity = 30;
itemCapacity = 40;
heatRequirement = 8f;
craftTime = 60f * 5f;
liquidCapacity = 80f * 5;
craftTime = 60f * 2f;
liquidCapacity = 10f * 4;
ambientSound = Sounds.techloop;
ambientSoundVolume = 0.07f;
ambientSoundVolume = 0.03f;
outputItem = new ItemStack(Items.phaseFabric, 1);
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawCircles(){{
color = Color.valueOf("ffc073").a(0.24f);
strokeMax = 2.5f;
radius = 10f;
amount = 3;
}}, new DrawLiquidRegion(Liquids.slag), new DrawBlock(), new DrawHeatInput(), new DrawHeatRegion(){{
heatColor = Color.valueOf("ff6060ff");
}}, new DrawHeatRegion("-vents"){{
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawSpikes(){{
color = Color.valueOf("ffd59e");
stroke = 1.5f;
layers = 2;
amount = 12;
rotateSpeed = 0.5f;
layerSpeed = -0.9f;
}}, new DrawMultiWeave(), new DrawBlock(), new DrawHeatInput(), new DrawHeatRegion("-vents"){{
heatColor.a = 1f;
}});
iconOverride = new String[]{"-bottom", ""};
consumes.items(with(Items.thorium, 1, Items.sand, 4));
consumes.liquid(Liquids.ozone, 4f / 60f);
consumes.power(10f);
consumes.items(with(Items.thorium, 2, Items.sand, 6));
consumes.liquid(Liquids.ozone, 2f / 60f);
consumes.power(8f);
}};
//TODO needs to be completely redone from the ground up

View File

@ -13,7 +13,7 @@ public class DrawCircles extends DrawBlock{
public int amount = 5, sides = 15;
public float strokeMin = 0.2f, strokeMax = 2f, timeScl = 160f;
public float radius = 12f;
public float radius = 12f, radiusOffset = 0f, x = 0f, y = 0f;
public Interp strokeInterp = Interp.pow3In;
public DrawCircles(Color color){
@ -36,9 +36,9 @@ public class DrawCircles extends DrawBlock{
float life = ((Time.time / timeScl + i/(float)amount) % 1f);
Lines.stroke(build.warmup() * strokeInterp.apply(strokeMax, strokeMin, life));
Lines.poly(build.x, build.y, sides, life * radius);
Lines.poly(build.x + x, build.y + y, sides, radiusOffset + life * radius);
}
Draw.color();
Draw.reset();
}
}

View File

@ -0,0 +1,39 @@
package mindustry.world.draw;
import arc.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
import mindustry.gen.*;
import mindustry.world.*;
/** Not standalone. */
public class DrawMultiWeave extends DrawBlock{
public TextureRegion weave, glow;
public float rotateSpeed = 1f, rotateSpeed2 = -0.9f;
public Color glowColor = new Color(1f, 0.4f, 0.4f, 0.8f);
public float pulse = 0.3f, pulseScl = 10f;
@Override
public void drawBase(Building build){
Draw.rect(weave, build.x, build.y, build.totalProgress() * rotateSpeed);
Draw.rect(weave, build.x, build.y, build.totalProgress() * rotateSpeed * rotateSpeed2);
Draw.blend(Blending.additive);
Draw.color(glowColor, build.warmup() * (glowColor.a * (1f - pulse + Mathf.absin(pulseScl, pulse))));
Draw.rect(glow, build.x, build.y, build.totalProgress() * rotateSpeed);
Draw.rect(glow, build.x, build.y, build.totalProgress() * rotateSpeed * rotateSpeed2);
Draw.blend();
Draw.reset();
}
@Override
public void load(Block block){
weave = Core.atlas.find(block.name + "-weave");
glow = Core.atlas.find(block.name + "-weave-glow");
}
}

View File

@ -0,0 +1,42 @@
package mindustry.world.draw;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.util.*;
import mindustry.entities.units.*;
import mindustry.gen.*;
import mindustry.world.*;
public class DrawSpikes extends DrawBlock{
public Color color = Color.valueOf("7457ce");
public int amount = 10, layers = 1;
public float stroke = 2f, rotateSpeed = 0.8f;
public float radius = 6f, length = 4f, x = 0f, y = 0f, layerSpeed = -1f;
public DrawSpikes(Color color){
this.color = color;
}
public DrawSpikes(){
}
@Override
public void drawPlan(Block block, BuildPlan plan, Eachable<BuildPlan> list){}
@Override
public void drawBase(Building build){
if(build.warmup() <= 0.001f) return;
Draw.color(color, build.warmup() * color.a);
Lines.stroke(stroke);
float curSpeed = 1f;
for(int i = 0; i < layers; i++){
Lines.spikes(build.x + x, build.y + y, radius, length, amount, build.totalProgress() * rotateSpeed * curSpeed);
curSpeed *= layerSpeed;
}
Draw.reset();
}
}