Implemented bridge opacity from #1006
This commit is contained in:
@@ -268,6 +268,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
}
|
||||
return s + "%";
|
||||
});
|
||||
graphics.sliderPref("bridgeopacity", 75, 0, 100, 5, s -> s + "%");
|
||||
|
||||
if(!mobile){
|
||||
graphics.checkPref("vsync", true, b -> Core.graphics.setVSync(b));
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package mindustry.world.blocks.distribution;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.Mathf;
|
||||
import arc.math.geom.Geometry;
|
||||
import mindustry.world.Tile;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@@ -31,6 +32,10 @@ public class ExtendingItemBridge extends ItemBridge{
|
||||
ex *= uptime;
|
||||
ey *= uptime;
|
||||
|
||||
float opacity = Core.settings.getInt("bridgeopacity") / 100f;
|
||||
if(Mathf.zero(opacity)) return;
|
||||
Draw.alpha(opacity);
|
||||
|
||||
Lines.stroke(8f);
|
||||
Lines.line(bridgeRegion,
|
||||
tile.worldx() + Geometry.d4[i].x * tilesize / 2f,
|
||||
@@ -50,7 +55,7 @@ public class ExtendingItemBridge extends ItemBridge{
|
||||
Draw.color();
|
||||
|
||||
for(int a = 0; a < arrows; a++){
|
||||
Draw.alpha(Mathf.absin(a / (float)arrows - entity.time / 100f, 0.1f, 1f) * uptime);
|
||||
Draw.alpha(Mathf.absin(a / (float)arrows - entity.time / 100f, 0.1f, 1f) * uptime * opacity);
|
||||
Draw.rect(arrowRegion,
|
||||
tile.worldx() + Geometry.d4[i].x * (tilesize / 2f + a * 6f + 2) * uptime,
|
||||
tile.worldy() + Geometry.d4[i].y * (tilesize / 2f + a * 6f + 2) * uptime, i * 90f);
|
||||
|
||||
@@ -219,10 +219,13 @@ public class ItemBridge extends Block{
|
||||
Tile other = world.tile(entity.link);
|
||||
if(!linkValid(tile, other)) return;
|
||||
|
||||
float opacity = Core.settings.getInt("bridgeopacity") / 100f;
|
||||
if(Mathf.zero(opacity)) return;
|
||||
|
||||
int i = tile.absoluteRelativeTo(other.x, other.y);
|
||||
|
||||
Draw.color(Color.white, Color.black, Mathf.absin(Time.time(), 6f, 0.07f));
|
||||
Draw.alpha(Math.max(entity.uptime, 0.25f));
|
||||
Draw.alpha(Math.max(entity.uptime, 0.25f) * opacity);
|
||||
|
||||
Draw.rect(endRegion, tile.drawx(), tile.drawy(), i * 90 + 90);
|
||||
Draw.rect(endRegion, other.drawx(), other.drawy(), i * 90 + 270);
|
||||
@@ -242,7 +245,7 @@ public class ItemBridge extends Block{
|
||||
Draw.color();
|
||||
|
||||
for(int a = 0; a < arrows; a++){
|
||||
Draw.alpha(Mathf.absin(a / (float)arrows - entity.time / 100f, 0.1f, 1f) * entity.uptime);
|
||||
Draw.alpha(Mathf.absin(a / (float)arrows - entity.time / 100f, 0.1f, 1f) * entity.uptime * opacity);
|
||||
Draw.rect(arrowRegion,
|
||||
tile.worldx() + Geometry.d4[i].x * (tilesize / 2f + a * 4f + time % 4f),
|
||||
tile.worldy() + Geometry.d4[i].y * (tilesize / 2f + a * 4f + time % 4f), i * 90f);
|
||||
|
||||
Reference in New Issue
Block a user