Stacked map editor brush slider

This commit is contained in:
Anuken
2021-07-20 19:56:55 -04:00
parent 14e4203ee7
commit d506685bba
4 changed files with 12 additions and 9 deletions

View File

@@ -1161,6 +1161,7 @@ public class Blocks implements ContentList{
requirements(Category.power, with(Items.copper, 40, Items.graphite, 35, Items.lead, 50, Items.silicon, 35, Items.metaglass, 40));
powerProduction = 1.8f;
generateEffect = Fx.redgeneratespark;
effectChance = 0.013f;
size = 2;
floating = true;
ambientSound = Sounds.hum;

View File

@@ -1526,11 +1526,10 @@ public class Fx{
});
}),
redgeneratespark = new Effect(18, e -> {
randLenVectors(e.id, 5, e.fin() * 8f, (x, y) -> {
float len = e.fout() * 4f;
color(Pal.redSpark, Color.gray, e.fin());
Fill.circle(e.x + x, e.y + y, len/2f);
redgeneratespark = new Effect(80, e -> {
color(Pal.redSpark, Color.gray, e.fin());
randLenVectors(e.id, 2, e.finpow() * 9f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fslope() * 1.8f);
});
}),

View File

@@ -560,10 +560,12 @@ public class MapEditorDialog extends Dialog implements Disposable{
}
}
t.top();
t.add("@editor.brush");
var label = new Label("@editor.brush");
label.setAlignment(Align.center);
label.touchable = Touchable.disabled;
t.top().stack(slider, label).width(size * 3f - 20).padTop(4f);
t.row();
t.add(slider).width(size * 3f - 20).padTop(4f);
}).padTop(5).growX().top();
mid.row();

View File

@@ -12,6 +12,7 @@ import mindustry.world.meta.*;
public class ThermalGenerator extends PowerGenerator{
public Effect generateEffect = Fx.none;
public float effectChance = 0.05f;
public Attribute attribute = Attribute.heat;
public ThermalGenerator(String name){
@@ -52,7 +53,7 @@ public class ThermalGenerator extends PowerGenerator{
public void updateTile(){
productionEfficiency = sum + attribute.env();
if(productionEfficiency > 0.1f && Mathf.chance(0.05 * delta())){
if(productionEfficiency > 0.1f && Mathf.chanceDelta(effectChance)){
generateEffect.at(x + Mathf.range(3f), y + Mathf.range(3f));
}
}