Implemented bridge opacity from #1006

This commit is contained in:
Anuken
2020-01-08 16:16:19 -05:00
parent 7b4ee27fe4
commit a7cddf97b8
4 changed files with 17 additions and 7 deletions

View File

@@ -667,6 +667,7 @@ setting.savecreate.name = Auto-Create Saves
setting.publichost.name = Public Game Visibility setting.publichost.name = Public Game Visibility
setting.chatopacity.name = Chat Opacity setting.chatopacity.name = Chat Opacity
setting.lasersopacity.name = Power Laser Opacity setting.lasersopacity.name = Power Laser Opacity
setting.bridgeopacity.name = Bridge Opacity
setting.playerchat.name = Display Player Bubble Chat setting.playerchat.name = Display Player Bubble Chat
public.confirm = Do you want to make your game public?\n[accent]Anyone will be able to join your games.\n[lightgray]This can be changed later in Settings->Game->Public Game Visibility. public.confirm = Do you want to make your game public?\n[accent]Anyone will be able to join your games.\n[lightgray]This can be changed later in Settings->Game->Public Game Visibility.
public.beta = Note that beta versions of the game cannot make public lobbies. public.beta = Note that beta versions of the game cannot make public lobbies.
@@ -1212,7 +1213,7 @@ block.core-nucleus.description = The third and final iteration of the core capsu
block.vault.description = Stores a large amount of items of each type. An unloader block can be used to retrieve items from the vault. block.vault.description = Stores a large amount of items of each type. An unloader block can be used to retrieve items from the vault.
block.container.description = Stores a small amount of items of each type. An unloader block can be used to retrieve items from the container. block.container.description = Stores a small amount of items of each type. An unloader block can be used to retrieve items from the container.
block.unloader.description = Unloads items from any nearby non-transportation block. The type of item to be unloaded can be changed by tapping. block.unloader.description = Unloads items from any nearby non-transportation block. The type of item to be unloaded can be changed by tapping.
block.launch-pad.description = Launches batches of items without any need for a core launch. block.launch-pad.description = Launches batfches of items without any need for a core launch.
block.launch-pad-large.description = An improved version of the launch pad. Stores more items. Launches more frequently. block.launch-pad-large.description = An improved version of the launch pad. Stores more items. Launches more frequently.
block.duo.description = A small, cheap turret. Useful against ground units. block.duo.description = A small, cheap turret. Useful against ground units.
block.scatter.description = An essential anti-air turret. Sprays clumps of lead or scrap flak at enemy units. block.scatter.description = An essential anti-air turret. Sprays clumps of lead or scrap flak at enemy units.

View File

@@ -268,6 +268,7 @@ public class SettingsMenuDialog extends SettingsDialog{
} }
return s + "%"; return s + "%";
}); });
graphics.sliderPref("bridgeopacity", 75, 0, 100, 5, s -> s + "%");
if(!mobile){ if(!mobile){
graphics.checkPref("vsync", true, b -> Core.graphics.setVSync(b)); graphics.checkPref("vsync", true, b -> Core.graphics.setVSync(b));

View File

@@ -1,9 +1,10 @@
package mindustry.world.blocks.distribution; package mindustry.world.blocks.distribution;
import arc.*;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.math.Mathf; import arc.math.*;
import arc.math.geom.Geometry; import arc.math.geom.*;
import mindustry.world.Tile; import mindustry.world.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
@@ -31,6 +32,10 @@ public class ExtendingItemBridge extends ItemBridge{
ex *= uptime; ex *= uptime;
ey *= uptime; ey *= uptime;
float opacity = Core.settings.getInt("bridgeopacity") / 100f;
if(Mathf.zero(opacity)) return;
Draw.alpha(opacity);
Lines.stroke(8f); Lines.stroke(8f);
Lines.line(bridgeRegion, Lines.line(bridgeRegion,
tile.worldx() + Geometry.d4[i].x * tilesize / 2f, tile.worldx() + Geometry.d4[i].x * tilesize / 2f,
@@ -50,7 +55,7 @@ public class ExtendingItemBridge extends ItemBridge{
Draw.color(); Draw.color();
for(int a = 0; a < arrows; a++){ 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, Draw.rect(arrowRegion,
tile.worldx() + Geometry.d4[i].x * (tilesize / 2f + a * 6f + 2) * uptime, 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); tile.worldy() + Geometry.d4[i].y * (tilesize / 2f + a * 6f + 2) * uptime, i * 90f);

View File

@@ -219,10 +219,13 @@ public class ItemBridge extends Block{
Tile other = world.tile(entity.link); Tile other = world.tile(entity.link);
if(!linkValid(tile, other)) return; 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); int i = tile.absoluteRelativeTo(other.x, other.y);
Draw.color(Color.white, Color.black, Mathf.absin(Time.time(), 6f, 0.07f)); 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, tile.drawx(), tile.drawy(), i * 90 + 90);
Draw.rect(endRegion, other.drawx(), other.drawy(), i * 90 + 270); Draw.rect(endRegion, other.drawx(), other.drawy(), i * 90 + 270);
@@ -242,7 +245,7 @@ public class ItemBridge extends Block{
Draw.color(); Draw.color();
for(int a = 0; a < arrows; a++){ 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, Draw.rect(arrowRegion,
tile.worldx() + Geometry.d4[i].x * (tilesize / 2f + a * 4f + time % 4f), 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); tile.worldy() + Geometry.d4[i].y * (tilesize / 2f + a * 4f + time % 4f), i * 90f);