Merge branch 'master' into crater

This commit is contained in:
Patrick 'Quezler' Mounier
2020-04-02 12:05:04 +02:00
72 changed files with 2348 additions and 642 deletions

View File

@@ -43,15 +43,15 @@ public class LegacyColorMapper implements ContentList{
}
private void map(String color, Block block, Block wall, Block ore){
blockMap.put(Color.rgba8888(Color.valueOf(color)), new LegacyBlock(block, wall, ore));
blockMap.put(Color.valueOf(color).rgba(), new LegacyBlock(block, wall, ore));
}
private void map(String color, Block block, Block wall){
blockMap.put(Color.rgba8888(Color.valueOf(color)), new LegacyBlock(block, wall));
blockMap.put(Color.valueOf(color).rgba(), new LegacyBlock(block, wall));
}
private void map(String color, Block block){
blockMap.put(Color.rgba8888(Color.valueOf(color)), new LegacyBlock(block, Blocks.air));
blockMap.put(Color.valueOf(color).rgba(), new LegacyBlock(block, Blocks.air));
}
public static class LegacyBlock{

View File

@@ -100,7 +100,7 @@ public class ImpactReactor extends PowerGenerator{
Draw.rect(reg(bottomRegion), tile.drawx(), tile.drawy());
for(int i = 0; i < plasmas; i++){
float r = 29f + Mathf.absin(Time.time(), 2f + i * 1f, 5f - i * 0.5f);
float r = size * tilesize - 3f + Mathf.absin(Time.time(), 2f + i * 1f, 5f - i * 0.5f);
Draw.color(plasma1, plasma2, (float)i / plasmas);
Draw.alpha((0.3f + Mathf.absin(Time.time(), 2f + i * 2f, 0.3f + i * 0.05f)) * entity.warmup);

View File

@@ -1,8 +1,8 @@
package mindustry.world.blocks.power;
import arc.*;
import arc.struct.*;
import arc.math.*;
import arc.struct.*;
import arc.util.*;
import mindustry.world.*;
import mindustry.world.consumers.*;
@@ -199,6 +199,8 @@ public class PowerGraph{
lastPowerNeeded = powerNeeded;
lastPowerProduced = powerProduced;
powerBalance.addValue((lastPowerProduced - lastPowerNeeded) / Time.delta());
if(!(consumers.size == 0 && producers.size == 0 && batteries.size == 0)){
if(!Mathf.equal(powerNeeded, powerProduced)){
@@ -214,8 +216,6 @@ public class PowerGraph{
distributePower(powerNeeded, powerProduced);
}
powerBalance.addValue((lastPowerProduced - lastPowerNeeded) / Time.delta());
//overproducing: 10 / 20 = 0.5
//underproducing: 20 / 10 = 2 -> clamp -> 1.0
//nothing being produced: 20 / 0 -> 1.0