More unit tests / Lighting improvements

This commit is contained in:
Anuken
2019-11-16 23:45:31 -05:00
parent 4d3e268972
commit 629999a1cd
9 changed files with 36 additions and 14 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);

View File

@@ -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");

View File

@@ -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);