Merge branch 'master' into formatting

This commit is contained in:
Anuken
2020-10-30 09:26:51 -04:00
committed by GitHub
44 changed files with 508 additions and 382 deletions

View File

@@ -19,6 +19,7 @@ public class LiquidTurret extends Turret{
public ObjectMap<Liquid, BulletType> ammoTypes = new ObjectMap<>();
public @Load("@-liquid") TextureRegion liquidRegion;
public @Load("@-top") TextureRegion topRegion;
public boolean extinguish = true;
public LiquidTurret(String name){
super(name);
@@ -86,7 +87,7 @@ public class LiquidTurret extends Turret{
@Override
protected void findTarget(){
if(liquids.current().canExtinguish()){
if(extinguish && liquids.current().canExtinguish()){
int tr = (int)(range / tilesize);
for(int x = -tr; x <= tr; x++){
for(int y = -tr; y <= tr; y++){
@@ -144,7 +145,7 @@ public class LiquidTurret extends Turret{
@Override
public boolean acceptLiquid(Building source, Liquid liquid){
return ammoTypes.get(liquid) != null
&& (liquids.current() == liquid || (ammoTypes.containsKey(liquids.current())
&& (liquids.current() == liquid || (ammoTypes.containsKey(liquid)
&& liquids.get(liquids.current()) <= 1f / ammoTypes.get(liquids.current()).ammoMultiplier + 0.001f));
}
}

View File

@@ -12,6 +12,7 @@ import mindustry.graphics.*;
import mindustry.world.*;
import mindustry.world.blocks.payloads.*;
import mindustry.world.blocks.production.*;
import mindustry.world.meta.*;
import static mindustry.Vars.*;
@@ -24,7 +25,7 @@ public class PayloadConveyor extends Block{
public PayloadConveyor(String name){
super(name);
group = BlockGroup.transportation;
size = 3;
rotate = true;
update = true;

View File

@@ -40,7 +40,7 @@ public class MessageBlock extends Block{
int count = 0;
for(int i = 0; i < text.length(); i++){
char c = text.charAt(i);
if(c == '\n' || c == '\r'){
if(c == '\n'){
count ++;
if(count <= maxNewlines){
tile.message.append('\n');
@@ -95,12 +95,12 @@ public class MessageBlock extends Block{
}else{
BaseDialog dialog = new BaseDialog("@editmessage");
dialog.setFillParent(false);
TextArea a = dialog.cont.add(new TextArea(message.toString().replace("\n", "\r"))).size(380f, 160f).get();
TextArea a = dialog.cont.add(new TextArea(message.toString().replace("\r", "\n"))).size(380f, 160f).get();
a.setFilter((textField, c) -> {
if(c == '\n' || c == '\r'){
if(c == '\n'){
int count = 0;
for(int i = 0; i < textField.getText().length(); i++){
if(textField.getText().charAt(i) == '\n' || textField.getText().charAt(i) == '\r'){
if(textField.getText().charAt(i) == '\n'){
count++;
}
}

View File

@@ -280,8 +280,8 @@ public class PowerNode extends PowerBlock{
public void placed(){
if(net.client()) return;
Boolf<Building> valid = other -> other != null && other != this && ((!other.block.outputsPower && other.block.consumesPower) ||
(other.block.outputsPower && !other.block.consumesPower) || other.block instanceof PowerNode) && linkValid(this, other)
Boolf<Building> valid = other -> other != null && other != this &&
(other.block.outputsPower || other.block.consumesPower || other.block instanceof PowerNode) && linkValid(this, other)
&& !other.proximity().contains(this) && other.power.graph != power.graph;
tempTileEnts.clear();