Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -241,28 +241,34 @@ public class BlockRenderer implements Disposable{
|
||||
}
|
||||
|
||||
public void drawBlocks(Layer stopAt){
|
||||
|
||||
int startIdx = iterateidx;
|
||||
for(; iterateidx < requestidx; iterateidx++){
|
||||
BlockRequest request = requests.get(iterateidx);
|
||||
|
||||
if(iterateidx < requests.size && requests.get(iterateidx).layer.ordinal() > stopAt.ordinal()){
|
||||
if(request.layer.ordinal() > stopAt.ordinal()){
|
||||
break;
|
||||
}
|
||||
|
||||
BlockRequest req = requests.get(iterateidx);
|
||||
Block block = req.tile.block();
|
||||
if(request.layer == Layer.power){
|
||||
if(iterateidx - startIdx > 0 && request.tile.pos() == requests.get(iterateidx - 1).tile.pos()){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(req.layer == Layer.block){
|
||||
block.draw(req.tile);
|
||||
if(req.tile.entity != null && req.tile.entity.damaged()){
|
||||
block.drawCracks(req.tile);
|
||||
Block block = request.tile.block();
|
||||
|
||||
if(request.layer == Layer.block){
|
||||
block.draw(request.tile);
|
||||
if(request.tile.entity != null && request.tile.entity.damaged()){
|
||||
block.drawCracks(request.tile);
|
||||
}
|
||||
if(block.synthetic() && req.tile.getTeam() != player.getTeam()){
|
||||
block.drawTeam(req.tile);
|
||||
if(block.synthetic() && request.tile.getTeam() != player.getTeam()){
|
||||
block.drawTeam(request.tile);
|
||||
}
|
||||
}else if(req.layer == block.layer){
|
||||
block.drawLayer(req.tile);
|
||||
}else if(req.layer == block.layer2){
|
||||
block.drawLayer2(req.tile);
|
||||
}else if(request.layer == block.layer){
|
||||
block.drawLayer(request.tile);
|
||||
}else if(request.layer == block.layer2){
|
||||
block.drawLayer2(request.tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -327,7 +333,9 @@ public class BlockRenderer implements Disposable{
|
||||
|
||||
@Override
|
||||
public int compareTo(BlockRequest other){
|
||||
return layer.compareTo(other.layer);
|
||||
int compare = layer.compareTo(other.layer);
|
||||
|
||||
return (compare != 0) ? compare : Integer.compare(tile.pos(), other.tile.pos());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -255,6 +255,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
});
|
||||
graphics.sliderPref("fpscap", 240, 15, 245, 5, s -> (s > 240 ? Core.bundle.get("setting.fpscap.none") : Core.bundle.format("setting.fpscap.text", s)));
|
||||
graphics.sliderPref("chatopacity", 100, 0, 100, 5, s -> s + "%");
|
||||
graphics.sliderPref("lasersopacity", 100, 0, 100, 5, s -> s + "%");
|
||||
|
||||
if(!mobile){
|
||||
graphics.checkPref("vsync", true, b -> Core.graphics.setVSync(b));
|
||||
@@ -300,7 +301,6 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
graphics.checkPref("animatedshields", !mobile);
|
||||
}
|
||||
graphics.checkPref("bloom", false, val -> renderer.toggleBloom(val));
|
||||
graphics.checkPref("lasers", true);
|
||||
graphics.checkPref("pixelate", false, val -> {
|
||||
if(val){
|
||||
Events.fire(Trigger.enablePixelation);
|
||||
|
||||
@@ -275,15 +275,18 @@ public class PowerNode extends PowerBlock{
|
||||
|
||||
@Override
|
||||
public void drawLayer(Tile tile){
|
||||
if(!Core.settings.getBool("lasers")) return;
|
||||
if(Core.settings.getInt("lasersopacity") == 0) return;
|
||||
|
||||
TileEntity entity = tile.entity();
|
||||
|
||||
for(int i = 0; i < entity.power.links.size; i++){
|
||||
Tile link = world.tile(entity.power.links.get(i));
|
||||
if(linkValid(tile, link) && (link.pos() < tile.pos() || !(link.block() instanceof PowerNode) || !Core.camera.bounds(Tmp.r1).contains(link.drawx(), link.drawy()))){
|
||||
drawLaser(tile, link);
|
||||
}
|
||||
|
||||
if(!linkValid(tile, link)) continue;
|
||||
|
||||
if(link.block() instanceof PowerNode && !(link.pos() < tile.pos())) continue;
|
||||
|
||||
drawLaser(tile, link);
|
||||
}
|
||||
|
||||
Draw.reset();
|
||||
@@ -318,6 +321,11 @@ public class PowerNode extends PowerBlock{
|
||||
}
|
||||
|
||||
protected void drawLaser(Tile tile, Tile target){
|
||||
int opacityPercentage = Core.settings.getInt("lasersopacity");
|
||||
if(opacityPercentage == 0) return;
|
||||
|
||||
float opacity = opacityPercentage / 100f;
|
||||
|
||||
float x1 = tile.drawx(), y1 = tile.drawy(),
|
||||
x2 = target.drawx(), y2 = target.drawy();
|
||||
|
||||
@@ -333,7 +341,8 @@ public class PowerNode extends PowerBlock{
|
||||
float fract = 1f-tile.entity.power.graph.getSatisfaction();
|
||||
|
||||
Draw.color(Color.white, Pal.powerLight, fract*0.86f + Mathf.absin(3f, 0.1f));
|
||||
Drawf.laser(laser, laserEnd, x1, y1, x2, y2, 0.3f);
|
||||
Draw.alpha(opacity);
|
||||
Drawf.laser(laser, laserEnd, x1, y1, x2, y2, 0.25f);
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user