More unit tests / Lighting improvements
This commit is contained in:
@@ -737,7 +737,8 @@ public class Blocks implements ContentList{
|
||||
requirements(Category.effect, ItemStack.with(Items.graphite, 5));
|
||||
}};
|
||||
illuminator = new LightBlock("illuminator"){{
|
||||
requirements(Category.effect, ItemStack.with(Items.graphite, 5));
|
||||
//disabled until implemented properly
|
||||
//requirements(Category.effect, ItemStack.with(Items.graphite, 5));
|
||||
color = Color.valueOf("7d93ff");
|
||||
brightness = 0.6f;
|
||||
radius = 80f;
|
||||
|
||||
@@ -167,6 +167,8 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
||||
}
|
||||
|
||||
public void writeSave(DataOutput stream, boolean net) throws IOException{
|
||||
if(item.item == null) item.item = Items.copper;
|
||||
|
||||
stream.writeByte(team.ordinal());
|
||||
stream.writeBoolean(isDead());
|
||||
stream.writeFloat(net ? interpolator.target.x : x);
|
||||
|
||||
@@ -75,7 +75,7 @@ public class Rules{
|
||||
/** Blocks that cannot be placed. */
|
||||
public ObjectSet<Block> bannedBlocks = new ObjectSet<>();
|
||||
/** Whether everything is dark. Enables lights. Experimental. */
|
||||
public boolean lighting = false;
|
||||
public boolean lighting = true;
|
||||
/** Ambient light color, used when lighting is enabled. */
|
||||
public Color ambientLight = new Color(0.01f, 0.01f, 0.04f, 0.99f);
|
||||
|
||||
|
||||
@@ -50,9 +50,9 @@ public class LightRenderer{
|
||||
if(!enabled()) return;
|
||||
|
||||
add(() -> {
|
||||
Draw.color(Color.orange, 0.5f);
|
||||
Draw.color(Color.orange, 0.3f);
|
||||
|
||||
float stroke = 10f;
|
||||
float stroke = 30f;
|
||||
float rot = Mathf.angleExact(x2 - x, y2 - y);
|
||||
TextureRegion ledge = Core.atlas.find("circle-end"), lmid = Core.atlas.find("circle-mid");
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package io.anuke.mindustry.world.blocks.power;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.mindustry.content.Fx;
|
||||
import io.anuke.mindustry.entities.Effects;
|
||||
import io.anuke.mindustry.entities.Effects.Effect;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.meta.Attribute;
|
||||
import io.anuke.arc.*;
|
||||
import io.anuke.arc.graphics.*;
|
||||
import io.anuke.arc.math.*;
|
||||
import io.anuke.mindustry.content.*;
|
||||
import io.anuke.mindustry.entities.*;
|
||||
import io.anuke.mindustry.entities.Effects.*;
|
||||
import io.anuke.mindustry.world.*;
|
||||
import io.anuke.mindustry.world.meta.*;
|
||||
|
||||
import static io.anuke.mindustry.Vars.renderer;
|
||||
|
||||
public class ThermalGenerator extends PowerGenerator{
|
||||
protected Effect generateEffect = Fx.none;
|
||||
@@ -29,6 +32,12 @@ public class ThermalGenerator extends PowerGenerator{
|
||||
drawPlaceText(Core.bundle.formatFloat("bar.efficiency", sumAttribute(Attribute.heat, x, y) * 100, 1), x, y, valid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawLight(Tile tile){
|
||||
GeneratorEntity entity = tile.entity();
|
||||
renderer.lights.add(tile.drawx(), tile.drawy(), (40f + Mathf.absin(10f, 5f)) * entity.productionEfficiency * size, Color.scarlet, 0.4f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProximityAdded(Tile tile){
|
||||
super.onProximityAdded(tile);
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||
archash=68a64d9e8a3016ad433d0959be78f6acdcdaa385
|
||||
archash=7f36ea330f592f43ad01b729c4cae77797476ea7
|
||||
|
||||
@@ -60,6 +60,7 @@ public class ApplicationTests{
|
||||
super.init();
|
||||
begins[0] = true;
|
||||
testMap = maps.loadInternalMap("groundZero");
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -216,15 +217,24 @@ public class ApplicationTests{
|
||||
}
|
||||
|
||||
@Test
|
||||
void loadOldSave(){
|
||||
void load77Save(){
|
||||
resetWorld();
|
||||
SaveIO.load(Core.files.internal("build77.msav"));
|
||||
SaveIO.load(Core.files.internal("77.msav"));
|
||||
|
||||
//just tests if the map was loaded properly and didn't crash, no validity checks currently
|
||||
assertEquals(276, world.width());
|
||||
assertEquals(10, world.height());
|
||||
}
|
||||
|
||||
@Test
|
||||
void load85Save(){
|
||||
resetWorld();
|
||||
SaveIO.load(Core.files.internal("85.msav"));
|
||||
|
||||
assertEquals(250, world.width());
|
||||
assertEquals(300, world.height());
|
||||
}
|
||||
|
||||
@Test
|
||||
void arrayIterators(){
|
||||
Array<String> arr = Array.with("a", "b" , "c", "d", "e", "f");
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user