1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-20 12:58:38 +03:00
This commit is contained in:
Anuken 2019-04-10 17:47:22 -04:00
parent 98a53381fb
commit 5783b61631
7 changed files with 9 additions and 21 deletions

View File

@ -1520,14 +1520,14 @@ public class Blocks implements ContentList{
recoil = 4f;
size = 4;
shootShake = 2f;
powerUsed = 0.5f;
consumes.powerBuffered(1200f);
range = 190f;
reload = 50f;
firingMoveFract = 0.5f;
shootDuration = 220f;
powerUsed = 1f / 2f;
health = 200 * size * size;
consumes.powerBuffered(1200f);
consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 0.5f)).update(false);
}};

View File

@ -38,7 +38,7 @@ public class Zones implements ContentList{
conditionWave = 10;
zoneRequirements = ZoneRequirement.with(groundZero, 10);
blockRequirements = new Block[]{Blocks.router};
resources = new Item[]{Items.copper, Items.lead, Items.coal};
resources = new Item[]{Items.copper, Items.lead, Items.coal, Items.sand};
rules = () -> new Rules(){{
waves = true;
waveTimer = true;

View File

@ -638,8 +638,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
}
protected void updateFlying(){
if(Units.invalidateTarget(target, this) && !(target instanceof TileEntity && ((TileEntity)target).damaged() && target.getTeam() == team &&
mech.canHeal && dst(target) < getWeapon().bullet.range())){
if(Units.invalidateTarget(target, this) && !(target instanceof TileEntity && ((TileEntity)target).damaged() && target.isValid() && ((TileEntity)target).isAdded() && target.getTeam() == team && mech.canHeal && dst(target) < getWeapon().bullet.range())){
target = null;
}

View File

@ -26,10 +26,10 @@ import io.anuke.mindustry.net.Packets.AdminAction;
import io.anuke.mindustry.ui.*;
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
import static io.anuke.mindustry.Vars.*;
import java.lang.StringBuilder;
import static io.anuke.mindustry.Vars.*;
public class HudFragment extends Fragment{
public final PlacementFragment blockfrag = new PlacementFragment();
@ -480,6 +480,6 @@ public class HudFragment extends Fragment{
}
}).growY().fillX().right().width(40f)
.visible(() -> state.rules.waves && ((Net.server() || player.isAdmin) || !Net.active()) && state.enemies() == 0
&& (!world.spawner.isSpawning() || !state.rules.waveTimer));
&& !world.spawner.isSpawning());
}
}

View File

@ -118,7 +118,7 @@ public class PowerGraph{
public void distributePower(float needed, float produced){
//distribute even if not needed. this is because some might be requiring power but not requesting it; it updates consumers
float coverage = Mathf.isZero(needed) ? 1f : Math.min(1, produced / needed);
float coverage = Mathf.isZero(needed) && Mathf.isZero(produced) ? 0f : Mathf.isZero(needed) ? 1f : Math.min(1, produced / needed);
for(Tile consumer : consumers){
Consumers consumes = consumer.block().consumes;
if(consumes.hasPower()){

View File

@ -1,11 +0,0 @@
import org.junit.jupiter.api.BeforeAll;
public class MapTests{
@BeforeAll
static void launchApplication(){
ApplicationTests.launchApplication();
}
//TODO
}

View File

@ -42,7 +42,7 @@ public class PowerTests extends PowerTestFixture{
// That's why we inject the description into the test method for now.
// Additional Note: If you don't see any labels in front of the values supplied as function parameters, use a better IDE like IntelliJ IDEA.
dynamicTest("01", () -> simulateDirectConsumption(0.0f, 1.0f, 0.0f, "0.0 produced, 1.0 consumed (no power available)")),
dynamicTest("02", () -> simulateDirectConsumption(0.0f, 0.0f, 1.0f, "0.0 produced, 0.0 consumed (no power anywhere)")),
dynamicTest("02", () -> simulateDirectConsumption(0.0f, 0.0f, 0.0f, "0.0 produced, 0.0 consumed (no power anywhere)")),
dynamicTest("03", () -> simulateDirectConsumption(1.0f, 0.0f, 1.0f, "1.0 produced, 0.0 consumed (no power requested)")),
dynamicTest("04", () -> simulateDirectConsumption(1.0f, 1.0f, 1.0f, "1.0 produced, 1.0 consumed (stable consumption)")),
dynamicTest("05", () -> simulateDirectConsumption(0.5f, 1.0f, 0.5f, "0.5 produced, 1.0 consumed (power shortage)")),