Fixed more flaky tests

This commit is contained in:
Anuken 2021-06-26 20:55:52 -04:00
parent 604e6f8c47
commit bc6fcbc86d
5 changed files with 15 additions and 13 deletions

View File

@ -854,7 +854,7 @@ public class Fx{
fireRemove = new Effect(70f, e -> {
if(Fire.regions[0] == null) return;
alpha(e.fout());
rect(Fire.regions[((int)(e.rotation + e.fin() * Fire.frames)) % Fire.frames], e.x, e.y);
rect(Fire.regions[((int)(e.rotation + e.fin() * Fire.frames)) % Fire.frames], e.x + Mathf.randomSeedRange((int)e.y, 2), e.y + Mathf.randomSeedRange((int)e.x, 2));
Drawf.light(e.x, e.y, 50f + Mathf.absin(5f, 5f), Pal.lightFlame, 0.6f * e.fout());
}),

View File

@ -52,22 +52,22 @@ public class Puddles{
Puddle p = map.get(tile.pos());
if(p == null){
Puddle puddle = Puddle.create();
puddle.tile(tile);
puddle.liquid(liquid);
puddle.amount(amount);
puddle.generation(generation);
puddle.tile = tile;
puddle.liquid = liquid;
puddle.amount = amount;
puddle.generation = generation;
puddle.set((tile.worldx() + source.worldx()) / 2f, (tile.worldy() + source.worldy()) / 2f);
puddle.add();
map.put(tile.pos(), puddle);
}else if(p.liquid() == liquid){
p.accepting(Math.max(amount, p.accepting()));
}else if(p.liquid == liquid){
p.accepting = Math.max(amount, p.accepting);
if(generation == 0 && p.lastRipple <= Time.time - 40f && p.amount() >= maxLiquid / 2f){
Fx.ripple.at((tile.worldx() + source.worldx()) / 2f, (tile.worldy() + source.worldy()) / 2f, 1f, p.liquid().color);
if(generation == 0 && p.lastRipple <= Time.time - 40f && p.amount >= maxLiquid / 2f){
Fx.ripple.at((tile.worldx() + source.worldx()) / 2f, (tile.worldy() + source.worldy()) / 2f, 1f, p.liquid.color);
p.lastRipple = Time.time;
}
}else{
p.amount(p.amount() + reactPuddle(p.liquid(), liquid, amount, p.tile(), (p.x() + source.worldx())/2f, (p.y() + source.worldy())/2f));
p.amount += reactPuddle(p.liquid, liquid, amount, p.tile, (p.x + source.worldx())/2f, (p.y + source.worldy())/2f);
}
}

View File

@ -28,6 +28,7 @@ abstract class FireComp implements Timedc, Posc, Syncc, Drawc{
public static final TextureRegion[] regions = new TextureRegion[frames];
@Import float time, lifetime, x, y;
@Import int id;
Tile tile;
private transient Block block;
@ -116,7 +117,7 @@ abstract class FireComp implements Timedc, Posc, Syncc, Drawc{
Draw.alpha(Mathf.clamp(warmup / warmupDuration));
Draw.z(Layer.effect);
Draw.rect(regions[Math.min((int)animation, regions.length - 1)], x, y);
Draw.rect(regions[Math.min((int)animation, regions.length - 1)], x + Mathf.randomSeedRange((int)y, 2), y + Mathf.randomSeedRange((int)x, 2));
Draw.reset();
Drawf.light(x, y, 50f + Mathf.absin(5f, 5f), Pal.lightFlame, 0.6f * Mathf.clamp(warmup / warmupDuration));

View File

@ -24,7 +24,7 @@ public class ModTestBM extends GenericModTest{
assertNotNull(type, "A mod block must be loaded.");
assertSame(type.buildVisibility, BuildVisibility.shown, "A mod block must be buildable.");
world.loadMap(ApplicationTests.testMap);
world.loadMap(maps.loadInternalMap("groundZero"));
Tile t = world.tile(3, 3);
t.setBlock(type);

View File

@ -4,6 +4,7 @@ import mindustry.gen.*;
import mindustry.type.*;
import org.junit.jupiter.api.*;
import static mindustry.Vars.*;
import static org.junit.jupiter.api.Assertions.*;
//grabs a version-locked Heavy Armaments Industries commit and makes sure it initializes correctly
@ -22,7 +23,7 @@ public class ModTestHAI extends GenericModTest{
assertNotNull(type, "A mod unit must be loaded.");
assertTrue(type.weapons.size > 0, "A mod unit must have a weapon.");
Vars.world.loadMap(ApplicationTests.testMap);
Vars.world.loadMap(maps.loadInternalMap("groundZero"));
Unit unit = type.spawn(0, 0);