Fixed tests

This commit is contained in:
Anuken
2022-02-11 13:48:27 -05:00
parent 7ba42cb26e
commit 3728d137cd
8 changed files with 60 additions and 36 deletions

View File

@@ -3318,18 +3318,23 @@ public class Blocks{
disperse = new ItemTurret("disperse"){{
requirements(Category.turret, with(Items.carbide, 250, Items.surgeAlloy, 160, Items.silicon, 300, Items.beryllium, 400));
ammo(Items.graphite, new BasicBulletType(){{
ammo(Items.scrap, new BasicBulletType(){{
damage = 40;
speed = 7f;
width = 9f;
height = 15f;
speed = 8f;
width = 11f;
height = 16f;
trailColor = Pal.bulletYellowBack;
velocityInaccuracy = 0.11f;
collidesGround = false;
collidesTiles = false;
shootEffect = Fx.shootBig2;
smokeEffect = Fx.shootBigSmoke2;
}});
//TODO bullet.
//recoilAmount = 1f;
reloadTime = 5f;
reloadTime = 8f;
shootLength = 15f;
rotateSpeed = 5f;
@@ -3343,7 +3348,9 @@ public class Blocks{
shots = 4;
alternate = true;
widthSpread = true;
targetGround = false;
spread = 4.6f;
inaccuracy = 8f;
restitution = 0.1f;
shootWarmupSpeed = 0.08f;

View File

@@ -60,11 +60,18 @@ public class FogRenderer implements CustomChunk{
public void drawFog(){
//resize if world size changes
buffer.resize(world.width(), world.height());
boolean clear = buffer.resizeCheck(world.width(), world.height());
//set projection to whole map
Draw.proj(0, 0, buffer.getWidth() * tilesize, buffer.getHeight() * tilesize);
buffer.begin();
//if the buffer resized, it contains garbage now, clear it.
if(clear){
buffer.begin(Color.black);
}else{
buffer.begin();
}
Gl.blendEquationSeparate(Gl.max, Gl.max);
ScissorStack.push(rect.set(1, 1, buffer.getWidth() - 2, buffer.getHeight() - 2));

View File

@@ -203,6 +203,8 @@ public abstract class SaveFileReader{
public interface CustomChunk{
void write(DataOutput stream) throws IOException;
void read(DataInput stream) throws IOException;
boolean shouldWrite();
default boolean shouldWrite(){
return true;
}
}
}

View File

@@ -0,0 +1,31 @@
package mindustry.io.versions;
import arc.util.io.*;
import mindustry.io.*;
import mindustry.world.*;
import java.io.*;
import static mindustry.Vars.*;
/** This version does not read custom chunk data (<= 6). */
public class LegacyRegionSaveVersion extends SaveVersion{
public LegacyRegionSaveVersion(int version){
super(version);
}
@Override
public void read(DataInputStream stream, CounterInputStream counter, WorldContext context) throws IOException{
region("meta", stream, counter, this::readMeta);
region("content", stream, counter, this::readContentHeader);
try{
region("map", stream, counter, in -> readMap(in, context));
region("entities", stream, counter, this::readEntities);
}finally{
content.setTemporaryMapper(null);
}
}
}

View File

@@ -4,14 +4,13 @@ import arc.util.*;
import arc.util.io.*;
import mindustry.content.*;
import mindustry.game.*;
import mindustry.io.*;
import mindustry.world.*;
import java.io.*;
import static mindustry.Vars.*;
public abstract class LegacySaveVersion extends SaveVersion{
public abstract class LegacySaveVersion extends LegacyRegionSaveVersion{
public LegacySaveVersion(int version){
super(version);

View File

@@ -3,12 +3,11 @@ package mindustry.io.versions;
import arc.func.*;
import arc.util.io.*;
import mindustry.gen.*;
import mindustry.io.*;
import java.io.*;
/** This version did not read/write entity IDs to the save. */
public class LegacySaveVersion2 extends SaveVersion{
public class LegacySaveVersion2 extends LegacyRegionSaveVersion{
public LegacySaveVersion2(int version){
super(version);

View File

@@ -1,31 +1,9 @@
package mindustry.io.versions;
import arc.util.io.*;
import mindustry.io.*;
import mindustry.world.*;
import java.io.*;
import static mindustry.Vars.*;
/** This version does not read custom chunk data. */
public class Save6 extends SaveVersion{
public class Save6 extends LegacyRegionSaveVersion{
public Save6(){
super(6);
}
@Override
public void read(DataInputStream stream, CounterInputStream counter, WorldContext context) throws IOException{
region("meta", stream, counter, this::readMeta);
region("content", stream, counter, this::readContentHeader);
try{
region("map", stream, counter, in -> readMap(in, context));
region("entities", stream, counter, this::readEntities);
}finally{
content.setTemporaryMapper(null);
}
}
}

View File

@@ -553,6 +553,7 @@ public class Turret extends ReloadTurret{
bulletOffset.trns(rotation - 90, (spread) * i + Mathf.range(xRand), shootLength);
bullet(type, rotation + Mathf.range(inaccuracy + type.inaccuracy));
shotCounter ++;
effects();
}
}else{
bulletOffset.trns(rotation, shootLength, Mathf.range(xRand));
@@ -561,11 +562,11 @@ public class Turret extends ReloadTurret{
bullet(type, rotation + Mathf.range(inaccuracy + type.inaccuracy) + (i - (int)(shots / 2f)) * spread);
shotCounter ++;
}
effects();
}
recoil = recoilAmount;
heat = 1f;
effects();
useAmmo();
}
}