Merge branches 'lights' and 'master' of https://github.com/Anuken/Mindustry
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 754 B |
@@ -78,6 +78,7 @@ maps.browse = Browse Maps
|
|||||||
continue = Continue
|
continue = Continue
|
||||||
maps.none = [lightgray]No maps found!
|
maps.none = [lightgray]No maps found!
|
||||||
invalid = Invalid
|
invalid = Invalid
|
||||||
|
pickcolor = Pick Color
|
||||||
preparingconfig = Preparing Config
|
preparingconfig = Preparing Config
|
||||||
preparingcontent = Preparing Content
|
preparingcontent = Preparing Content
|
||||||
uploadingcontent = Uploading Content
|
uploadingcontent = Uploading Content
|
||||||
@@ -731,6 +732,9 @@ rules.title.resourcesbuilding = Resources & Building
|
|||||||
rules.title.player = Players
|
rules.title.player = Players
|
||||||
rules.title.enemy = Enemies
|
rules.title.enemy = Enemies
|
||||||
rules.title.unit = Units
|
rules.title.unit = Units
|
||||||
|
rules.title.experimental = Experimental
|
||||||
|
rules.lighting = Lighting
|
||||||
|
rules.ambientlight = Ambient Light
|
||||||
|
|
||||||
content.item.name = Items
|
content.item.name = Items
|
||||||
content.liquid.name = Liquids
|
content.liquid.name = Liquids
|
||||||
@@ -892,6 +896,7 @@ block.distributor.name = Distributor
|
|||||||
block.sorter.name = Sorter
|
block.sorter.name = Sorter
|
||||||
block.inverted-sorter.name = Inverted Sorter
|
block.inverted-sorter.name = Inverted Sorter
|
||||||
block.message.name = Message
|
block.message.name = Message
|
||||||
|
block.illuminator.name = Illuminator
|
||||||
block.overflow-gate.name = Overflow Gate
|
block.overflow-gate.name = Overflow Gate
|
||||||
block.silicon-smelter.name = Silicon Smelter
|
block.silicon-smelter.name = Silicon Smelter
|
||||||
block.phase-weaver.name = Phase Weaver
|
block.phase-weaver.name = Phase Weaver
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#ifdef GL_ES
|
||||||
|
precision mediump float;
|
||||||
|
precision mediump int;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define steprad 0.13
|
||||||
|
|
||||||
|
uniform sampler2D u_texture;
|
||||||
|
uniform vec4 u_ambient;
|
||||||
|
|
||||||
|
varying vec4 v_color;
|
||||||
|
varying vec2 v_texCoord;
|
||||||
|
|
||||||
|
void main(){
|
||||||
|
vec4 color = texture2D(u_texture, v_texCoord.xy);
|
||||||
|
//color.a = clamp(color.a, 0.0, 0.8);
|
||||||
|
gl_FragColor = clamp(vec4(mix(u_ambient.rgb, color.rgb, color.a), u_ambient.a - color.a), 0.0, 1.0);
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 739 B After Width: | Height: | Size: 742 B |
|
Before Width: | Height: | Size: 720 KiB After Width: | Height: | Size: 736 KiB |
|
Before Width: | Height: | Size: 260 KiB After Width: | Height: | Size: 260 KiB |
|
Before Width: | Height: | Size: 888 KiB After Width: | Height: | Size: 897 KiB |
@@ -48,7 +48,7 @@ public class Blocks implements ContentList{
|
|||||||
melter, separator, sporePress, pulverizer, incinerator, coalCentrifuge,
|
melter, separator, sporePress, pulverizer, incinerator, coalCentrifuge,
|
||||||
|
|
||||||
//sandbox
|
//sandbox
|
||||||
powerSource, powerVoid, itemSource, itemVoid, liquidSource, message,
|
powerSource, powerVoid, itemSource, itemVoid, liquidSource, message, illuminator,
|
||||||
|
|
||||||
//defense
|
//defense
|
||||||
scrapWall, scrapWallLarge, scrapWallHuge, scrapWallGigantic, thruster, //ok, these names are getting ridiculous, but at least I don't have humongous walls yet
|
scrapWall, scrapWallLarge, scrapWallHuge, scrapWallGigantic, thruster, //ok, these names are getting ridiculous, but at least I don't have humongous walls yet
|
||||||
@@ -736,6 +736,13 @@ public class Blocks implements ContentList{
|
|||||||
message = new MessageBlock("message"){{
|
message = new MessageBlock("message"){{
|
||||||
requirements(Category.effect, ItemStack.with(Items.graphite, 5));
|
requirements(Category.effect, ItemStack.with(Items.graphite, 5));
|
||||||
}};
|
}};
|
||||||
|
illuminator = new LightBlock("illuminator"){{
|
||||||
|
requirements(Category.effect, ItemStack.with(Items.graphite, 5));
|
||||||
|
color = Color.valueOf("7d93ff");
|
||||||
|
brightness = 0.6f;
|
||||||
|
radius = 80f;
|
||||||
|
consumes.power(0.05f);
|
||||||
|
}};
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
//region defense
|
//region defense
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import io.anuke.mindustry.graphics.*;
|
|||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.ui.Cicon;
|
import io.anuke.mindustry.ui.Cicon;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.tilesize;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class Fx implements ContentList{
|
public class Fx implements ContentList{
|
||||||
public static Effect
|
public static Effect
|
||||||
@@ -456,6 +456,8 @@ public class Fx implements ContentList{
|
|||||||
});
|
});
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
|
|
||||||
|
renderer.lights.add(e.x, e.y, 20f * e.fslope(), Pal.lightFlame, 0.5f);
|
||||||
});
|
});
|
||||||
|
|
||||||
fireSmoke = new Effect(35f, e -> {
|
fireSmoke = new Effect(35f, e -> {
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public class Renderer implements ApplicationListener{
|
|||||||
public final BlockRenderer blocks = new BlockRenderer();
|
public final BlockRenderer blocks = new BlockRenderer();
|
||||||
public final MinimapRenderer minimap = new MinimapRenderer();
|
public final MinimapRenderer minimap = new MinimapRenderer();
|
||||||
public final OverlayRenderer overlays = new OverlayRenderer();
|
public final OverlayRenderer overlays = new OverlayRenderer();
|
||||||
|
public final LightRenderer lights = new LightRenderer();
|
||||||
public final Pixelator pixelator = new Pixelator();
|
public final Pixelator pixelator = new Pixelator();
|
||||||
|
|
||||||
public FrameBuffer shieldBuffer = new FrameBuffer(2, 2);
|
public FrameBuffer shieldBuffer = new FrameBuffer(2, 2);
|
||||||
@@ -256,6 +257,7 @@ public class Renderer implements ApplicationListener{
|
|||||||
drawFlyerShadows();
|
drawFlyerShadows();
|
||||||
|
|
||||||
blocks.drawBlocks(Layer.power);
|
blocks.drawBlocks(Layer.power);
|
||||||
|
blocks.drawBlocks(Layer.lights);
|
||||||
|
|
||||||
drawAllTeams(true);
|
drawAllTeams(true);
|
||||||
|
|
||||||
@@ -298,6 +300,10 @@ public class Renderer implements ApplicationListener{
|
|||||||
|
|
||||||
playerGroup.draw(p -> !p.isDead(), Player::drawName);
|
playerGroup.draw(p -> !p.isDead(), Player::drawName);
|
||||||
|
|
||||||
|
if(state.rules.lighting){
|
||||||
|
lights.draw();
|
||||||
|
}
|
||||||
|
|
||||||
drawLanding();
|
drawLanding();
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
public MinimapDialog minimap;
|
public MinimapDialog minimap;
|
||||||
public SchematicsDialog schematics;
|
public SchematicsDialog schematics;
|
||||||
public ModsDialog mods;
|
public ModsDialog mods;
|
||||||
|
public ColorPicker picker;
|
||||||
|
|
||||||
public Cursor drillCursor, unloadCursor;
|
public Cursor drillCursor, unloadCursor;
|
||||||
|
|
||||||
@@ -211,6 +212,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
listfrag = new PlayerListFragment();
|
listfrag = new PlayerListFragment();
|
||||||
loadfrag = new LoadingFragment();
|
loadfrag = new LoadingFragment();
|
||||||
|
|
||||||
|
picker = new ColorPicker();
|
||||||
editor = new MapEditorDialog();
|
editor = new MapEditorDialog();
|
||||||
controls = new ControlsDialog();
|
controls = new ControlsDialog();
|
||||||
restart = new GameOverDialog();
|
restart = new GameOverDialog();
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import io.anuke.mindustry.entities.bullet.*;
|
|||||||
import io.anuke.mindustry.entities.effect.*;
|
import io.anuke.mindustry.entities.effect.*;
|
||||||
import io.anuke.mindustry.entities.traits.*;
|
import io.anuke.mindustry.entities.traits.*;
|
||||||
import io.anuke.mindustry.game.*;
|
import io.anuke.mindustry.game.*;
|
||||||
|
import io.anuke.mindustry.graphics.*;
|
||||||
import io.anuke.mindustry.world.*;
|
import io.anuke.mindustry.world.*;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
@@ -294,6 +295,7 @@ public class Bullet extends SolidEntity implements DamageTrait, ScaleTrait, Pool
|
|||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
type.draw(this);
|
type.draw(this);
|
||||||
|
renderer.lights.add(x, y, 16f, Pal.powerLight, 0.3f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -24,9 +24,7 @@ import io.anuke.mindustry.io.*;
|
|||||||
import io.anuke.mindustry.net.Administration.*;
|
import io.anuke.mindustry.net.Administration.*;
|
||||||
import io.anuke.mindustry.net.*;
|
import io.anuke.mindustry.net.*;
|
||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.type.TypeID;
|
|
||||||
import io.anuke.mindustry.ui.*;
|
import io.anuke.mindustry.ui.*;
|
||||||
import io.anuke.mindustry.ui.Cicon;
|
|
||||||
import io.anuke.mindustry.world.*;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.mindustry.world.blocks.*;
|
import io.anuke.mindustry.world.blocks.*;
|
||||||
|
|
||||||
@@ -352,6 +350,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
|||||||
Draw.rect(getPowerCellRegion(), x + Angles.trnsx(rotation, mech.cellTrnsY, 0f), y + Angles.trnsy(rotation, mech.cellTrnsY, 0f), rotation - 90);
|
Draw.rect(getPowerCellRegion(), x + Angles.trnsx(rotation, mech.cellTrnsY, 0f), y + Angles.trnsy(rotation, mech.cellTrnsY, 0f), rotation - 90);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
drawBackItems(itemtime, isLocal);
|
drawBackItems(itemtime, isLocal);
|
||||||
|
drawLight();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -399,6 +399,12 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
|||||||
Draw.color();
|
Draw.color();
|
||||||
|
|
||||||
drawBackItems(item.amount > 0 ? 1f : 0f, false);
|
drawBackItems(item.amount > 0 ? 1f : 0f, false);
|
||||||
|
|
||||||
|
drawLight();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawLight(){
|
||||||
|
renderer.lights.add(x, y, 50f, Pal.powerLight, 0.6f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawBackItems(float itemtime, boolean number){
|
public void drawBackItems(float itemtime, boolean number){
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package io.anuke.mindustry.game;
|
|||||||
|
|
||||||
import io.anuke.annotations.Annotations.*;
|
import io.anuke.annotations.Annotations.*;
|
||||||
import io.anuke.arc.collection.*;
|
import io.anuke.arc.collection.*;
|
||||||
|
import io.anuke.arc.graphics.*;
|
||||||
import io.anuke.mindustry.content.*;
|
import io.anuke.mindustry.content.*;
|
||||||
import io.anuke.mindustry.io.*;
|
import io.anuke.mindustry.io.*;
|
||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
@@ -73,6 +74,10 @@ public class Rules{
|
|||||||
public Array<ItemStack> loadout = Array.with(ItemStack.with(Items.copper, 100));
|
public Array<ItemStack> loadout = Array.with(ItemStack.with(Items.copper, 100));
|
||||||
/** Blocks that cannot be placed. */
|
/** Blocks that cannot be placed. */
|
||||||
public ObjectSet<Block> bannedBlocks = new ObjectSet<>();
|
public ObjectSet<Block> bannedBlocks = new ObjectSet<>();
|
||||||
|
/** Whether everything is dark. Enables lights. Experimental. */
|
||||||
|
public boolean lighting = false;
|
||||||
|
/** Ambient light color, used when lighting is enabled. */
|
||||||
|
public Color ambientLight = new Color(0.01f, 0.01f, 0.04f, 0.99f);
|
||||||
|
|
||||||
/** Copies this ruleset exactly. Not very efficient at all, do not use often. */
|
/** Copies this ruleset exactly. Not very efficient at all, do not use often. */
|
||||||
public Rules copy(){
|
public Rules copy(){
|
||||||
|
|||||||
@@ -9,10 +9,9 @@ import io.anuke.arc.graphics.glutils.*;
|
|||||||
import io.anuke.arc.math.*;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.content.*;
|
import io.anuke.mindustry.content.*;
|
||||||
import io.anuke.mindustry.game.*;
|
|
||||||
import io.anuke.mindustry.game.EventType.*;
|
import io.anuke.mindustry.game.EventType.*;
|
||||||
import io.anuke.mindustry.game.Teams.*;
|
import io.anuke.mindustry.game.Teams.*;
|
||||||
import io.anuke.mindustry.ui.Cicon;
|
import io.anuke.mindustry.ui.*;
|
||||||
import io.anuke.mindustry.world.*;
|
import io.anuke.mindustry.world.*;
|
||||||
|
|
||||||
import static io.anuke.arc.Core.camera;
|
import static io.anuke.arc.Core.camera;
|
||||||
@@ -219,6 +218,10 @@ public class BlockRenderer implements Disposable{
|
|||||||
addRequest(tile, Layer.block);
|
addRequest(tile, Layer.block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(state.rules.lighting){
|
||||||
|
addRequest(tile, Layer.lights);
|
||||||
|
}
|
||||||
|
|
||||||
if(block.expanded || !expanded){
|
if(block.expanded || !expanded){
|
||||||
|
|
||||||
if(block.layer != null){
|
if(block.layer != null){
|
||||||
@@ -274,6 +277,9 @@ public class BlockRenderer implements Disposable{
|
|||||||
if(block.synthetic() && request.tile.getTeam() != player.getTeam()){
|
if(block.synthetic() && request.tile.getTeam() != player.getTeam()){
|
||||||
block.drawTeam(request.tile);
|
block.drawTeam(request.tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}else if(request.layer == Layer.lights){
|
||||||
|
block.drawLight(request.tile);
|
||||||
}else if(request.layer == block.layer){
|
}else if(request.layer == block.layer){
|
||||||
block.drawLayer(request.tile);
|
block.drawLayer(request.tile);
|
||||||
}else if(request.layer == block.layer2){
|
}else if(request.layer == block.layer2){
|
||||||
@@ -282,39 +288,6 @@ public class BlockRenderer implements Disposable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawTeamBlocks(Layer layer, Team team){
|
|
||||||
int index = this.iterateidx;
|
|
||||||
|
|
||||||
for(; index < requestidx; index++){
|
|
||||||
|
|
||||||
if(index < requests.size && requests.get(index).layer.ordinal() > layer.ordinal()){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
BlockRequest req = requests.get(index);
|
|
||||||
if(req.tile.getTeam() != team) continue;
|
|
||||||
|
|
||||||
Block block = req.tile.block();
|
|
||||||
|
|
||||||
if(req.layer == Layer.block){
|
|
||||||
block.draw(req.tile);
|
|
||||||
}else if(req.layer == block.layer){
|
|
||||||
block.drawLayer(req.tile);
|
|
||||||
}else if(req.layer == block.layer2){
|
|
||||||
block.drawLayer2(req.tile);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void skipLayer(Layer stopAt){
|
|
||||||
for(; iterateidx < requestidx; iterateidx++){
|
|
||||||
if(iterateidx < requests.size && requests.get(iterateidx).layer.ordinal() > stopAt.ordinal()){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addRequest(Tile tile, Layer layer){
|
private void addRequest(Tile tile, Layer layer){
|
||||||
if(requestidx >= requests.size){
|
if(requestidx >= requests.size){
|
||||||
requests.add(new BlockRequest());
|
requests.add(new BlockRequest());
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import io.anuke.arc.graphics.g2d.*;
|
|||||||
import io.anuke.arc.math.*;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
|
|
||||||
|
import static io.anuke.mindustry.Vars.renderer;
|
||||||
|
|
||||||
public class Drawf{
|
public class Drawf{
|
||||||
|
|
||||||
public static void dashCircle(float x, float y, float rad, Color color){
|
public static void dashCircle(float x, float y, float rad, Color color){
|
||||||
@@ -40,15 +42,6 @@ public class Drawf{
|
|||||||
square(x, y, radius, Pal.accent);
|
square(x, y, radius, Pal.accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
public static void square(float x, float y, float radius){
|
|
||||||
Lines.stroke(1f, Pal.gray);
|
|
||||||
Lines.square(x, y - 1f, radius + 1f, 45);
|
|
||||||
Lines.stroke(1f, Pal.accent);
|
|
||||||
Lines.square(x, y, radius + 1f, 45);
|
|
||||||
Draw.reset();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public static void arrow(float x, float y, float x2, float y2, float length, float radius){
|
public static void arrow(float x, float y, float x2, float y2, float length, float radius){
|
||||||
float angle = Angles.angle(x, y, x2, y2);
|
float angle = Angles.angle(x, y, x2, y2);
|
||||||
float space = 2f;
|
float space = 2f;
|
||||||
@@ -81,6 +74,8 @@ public class Drawf{
|
|||||||
Lines.line(line, x + Tmp.v1.x, y + Tmp.v1.y, x2 - Tmp.v1.x, y2 - Tmp.v1.y, CapStyle.none, 0f);
|
Lines.line(line, x + Tmp.v1.x, y + Tmp.v1.y, x2 - Tmp.v1.x, y2 - Tmp.v1.y, CapStyle.none, 0f);
|
||||||
Lines.precise(false);
|
Lines.precise(false);
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
|
|
||||||
|
renderer.lights.line(x, y, x2, y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void tri(float x, float y, float width, float length, float rotation){
|
public static void tri(float x, float y, float width, float length, float rotation){
|
||||||
|
|||||||
@@ -10,5 +10,7 @@ public enum Layer{
|
|||||||
/** "High" blocks, like turrets. */
|
/** "High" blocks, like turrets. */
|
||||||
turret,
|
turret,
|
||||||
/** Power lasers. */
|
/** Power lasers. */
|
||||||
power
|
power,
|
||||||
|
/** Extra layer that's always on top.*/
|
||||||
|
lights
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,199 @@
|
|||||||
|
package io.anuke.mindustry.graphics;
|
||||||
|
|
||||||
|
import io.anuke.arc.*;
|
||||||
|
import io.anuke.arc.collection.*;
|
||||||
|
import io.anuke.arc.graphics.*;
|
||||||
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
|
import io.anuke.arc.graphics.glutils.*;
|
||||||
|
import io.anuke.arc.math.*;
|
||||||
|
import io.anuke.arc.math.geom.*;
|
||||||
|
import io.anuke.arc.util.*;
|
||||||
|
|
||||||
|
import static io.anuke.mindustry.Vars.state;
|
||||||
|
|
||||||
|
/** Renders overlay lights. Client only. */
|
||||||
|
public class LightRenderer{
|
||||||
|
private static final int scaling = 4;
|
||||||
|
private float[] vertices = new float[24];
|
||||||
|
private FrameBuffer buffer = new FrameBuffer(2, 2);
|
||||||
|
private Array<Runnable> lights = new Array<>();
|
||||||
|
|
||||||
|
public void add(Runnable run){
|
||||||
|
if(!enabled()) return;
|
||||||
|
|
||||||
|
lights.add(run);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(float x, float y, float radius, Color color, float opacity){
|
||||||
|
if(!enabled()) return;
|
||||||
|
|
||||||
|
float res = color.toFloatBits();
|
||||||
|
add(() -> {
|
||||||
|
Draw.color(res);
|
||||||
|
Draw.alpha(opacity);
|
||||||
|
Draw.rect("circle-shadow", x, y, radius * 2, radius * 2);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(float x, float y, TextureRegion region, Color color, float opacity){
|
||||||
|
if(!enabled()) return;
|
||||||
|
|
||||||
|
float res = color.toFloatBits();
|
||||||
|
add(() -> {
|
||||||
|
Draw.color(res);
|
||||||
|
Draw.alpha(opacity);
|
||||||
|
Draw.rect(region, x, y);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void line(float x, float y, float x2, float y2){
|
||||||
|
if(!enabled()) return;
|
||||||
|
|
||||||
|
add(() -> {
|
||||||
|
Draw.color(Color.orange, 0.5f);
|
||||||
|
|
||||||
|
float stroke = 10f;
|
||||||
|
float rot = Mathf.angleExact(x2 - x, y2 - y);
|
||||||
|
TextureRegion ledge = Core.atlas.find("circle-end"), lmid = Core.atlas.find("circle-mid");
|
||||||
|
|
||||||
|
float color = Draw.getColor().toFloatBits();
|
||||||
|
float u = lmid.getU();
|
||||||
|
float v = lmid.getV2();
|
||||||
|
float u2 = lmid.getU2();
|
||||||
|
float v2 = lmid.getV();
|
||||||
|
|
||||||
|
|
||||||
|
Vector2 v1 = Tmp.v1.trnsExact(rot + 90f, stroke);
|
||||||
|
float lx1 = x - v1.x, ly1 = y - v1.y,
|
||||||
|
lx2 = x + v1.x, ly2 = y + v1.y,
|
||||||
|
lx3 = x2 + v1.x, ly3 = y2 + v1.y,
|
||||||
|
lx4 = x2 - v1.x, ly4 = y2 - v1.y;
|
||||||
|
|
||||||
|
vertices[0] = lx1;
|
||||||
|
vertices[1] = ly1;
|
||||||
|
vertices[2] = color;
|
||||||
|
vertices[3] = u;
|
||||||
|
vertices[4] = v;
|
||||||
|
vertices[5] = 0;
|
||||||
|
|
||||||
|
vertices[6] = lx2;
|
||||||
|
vertices[7] = ly2;
|
||||||
|
vertices[8] = color;
|
||||||
|
vertices[9] = u;
|
||||||
|
vertices[10] = v2;
|
||||||
|
vertices[11] = 0;
|
||||||
|
|
||||||
|
vertices[12] = lx3;
|
||||||
|
vertices[13] = ly3;
|
||||||
|
vertices[14] = color;
|
||||||
|
vertices[15] = u2;
|
||||||
|
vertices[16] = v2;
|
||||||
|
vertices[17] = 0;
|
||||||
|
|
||||||
|
vertices[18] = lx4;
|
||||||
|
vertices[19] = ly4;
|
||||||
|
vertices[20] = color;
|
||||||
|
vertices[21] = u2;
|
||||||
|
vertices[22] = v;
|
||||||
|
vertices[23] = 0;
|
||||||
|
|
||||||
|
Draw.vert(ledge.getTexture(), vertices, 0, vertices.length);
|
||||||
|
|
||||||
|
|
||||||
|
Vector2 v3 = Tmp.v2.trnsExact(rot, stroke);
|
||||||
|
|
||||||
|
u = ledge.getU();
|
||||||
|
v = ledge.getV2();
|
||||||
|
u2 = ledge.getU2();
|
||||||
|
v2 = ledge.getV();
|
||||||
|
|
||||||
|
vertices[0] = lx4;
|
||||||
|
vertices[1] = ly4;
|
||||||
|
vertices[2] = color;
|
||||||
|
vertices[3] = u;
|
||||||
|
vertices[4] = v;
|
||||||
|
vertices[5] = 0;
|
||||||
|
|
||||||
|
vertices[6] = lx3;
|
||||||
|
vertices[7] = ly3;
|
||||||
|
vertices[8] = color;
|
||||||
|
vertices[9] = u;
|
||||||
|
vertices[10] = v2;
|
||||||
|
vertices[11] = 0;
|
||||||
|
|
||||||
|
vertices[12] = lx3 + v3.x;
|
||||||
|
vertices[13] = ly3 + v3.y;
|
||||||
|
vertices[14] = color;
|
||||||
|
vertices[15] = u2;
|
||||||
|
vertices[16] = v2;
|
||||||
|
vertices[17] = 0;
|
||||||
|
|
||||||
|
vertices[18] = lx4 + v3.x;
|
||||||
|
vertices[19] = ly4 + v3.y;
|
||||||
|
vertices[20] = color;
|
||||||
|
vertices[21] = u2;
|
||||||
|
vertices[22] = v;
|
||||||
|
vertices[23] = 0;
|
||||||
|
|
||||||
|
Draw.vert(ledge.getTexture(), vertices, 0, vertices.length);
|
||||||
|
|
||||||
|
vertices[0] = lx2;
|
||||||
|
vertices[1] = ly2;
|
||||||
|
vertices[2] = color;
|
||||||
|
vertices[3] = u;
|
||||||
|
vertices[4] = v;
|
||||||
|
vertices[5] = 0;
|
||||||
|
|
||||||
|
vertices[6] = lx1;
|
||||||
|
vertices[7] = ly1;
|
||||||
|
vertices[8] = color;
|
||||||
|
vertices[9] = u;
|
||||||
|
vertices[10] = v2;
|
||||||
|
vertices[11] = 0;
|
||||||
|
|
||||||
|
vertices[12] = lx1 - v3.x;
|
||||||
|
vertices[13] = ly1 - v3.y;
|
||||||
|
vertices[14] = color;
|
||||||
|
vertices[15] = u2;
|
||||||
|
vertices[16] = v2;
|
||||||
|
vertices[17] = 0;
|
||||||
|
|
||||||
|
vertices[18] = lx2 - v3.x;
|
||||||
|
vertices[19] = ly2 - v3.y;
|
||||||
|
vertices[20] = color;
|
||||||
|
vertices[21] = u2;
|
||||||
|
vertices[22] = v;
|
||||||
|
vertices[23] = 0;
|
||||||
|
|
||||||
|
Draw.vert(ledge.getTexture(), vertices, 0, vertices.length);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean enabled(){
|
||||||
|
return state.rules.lighting;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw(){
|
||||||
|
if(buffer.getWidth() != Core.graphics.getWidth()/scaling || buffer.getHeight() != Core.graphics.getHeight()/scaling){
|
||||||
|
buffer.resize(Core.graphics.getWidth()/scaling, Core.graphics.getHeight()/scaling);
|
||||||
|
}
|
||||||
|
|
||||||
|
Draw.color();
|
||||||
|
buffer.beginDraw(Color.clear);
|
||||||
|
Draw.blend(Blending.normal);
|
||||||
|
for(Runnable run : lights){
|
||||||
|
run.run();
|
||||||
|
}
|
||||||
|
Draw.reset();
|
||||||
|
Draw.blend();
|
||||||
|
buffer.endDraw();
|
||||||
|
|
||||||
|
Draw.color();
|
||||||
|
Shaders.light.ambient.set(state.rules.ambientLight);
|
||||||
|
Draw.shader(Shaders.light);
|
||||||
|
Draw.rect(Draw.wrap(buffer.getTexture()), Core.camera.position.x, Core.camera.position.y, Core.camera.width, -Core.camera.height);
|
||||||
|
Draw.shader();
|
||||||
|
|
||||||
|
lights.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,6 +16,7 @@ public class Shaders{
|
|||||||
public static UnitBuild build;
|
public static UnitBuild build;
|
||||||
public static FogShader fog;
|
public static FogShader fog;
|
||||||
public static MenuShader menu;
|
public static MenuShader menu;
|
||||||
|
public static LightShader light;
|
||||||
public static SurfaceShader water, tar;
|
public static SurfaceShader water, tar;
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
@@ -31,10 +32,25 @@ public class Shaders{
|
|||||||
build = new UnitBuild();
|
build = new UnitBuild();
|
||||||
fog = new FogShader();
|
fog = new FogShader();
|
||||||
menu = new MenuShader();
|
menu = new MenuShader();
|
||||||
|
light = new LightShader();
|
||||||
water = new SurfaceShader("water");
|
water = new SurfaceShader("water");
|
||||||
tar = new SurfaceShader("tar");
|
tar = new SurfaceShader("tar");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class LightShader extends LoadShader{
|
||||||
|
public Color ambient = new Color(0.01f, 0.01f, 0.04f, 0.99f);
|
||||||
|
|
||||||
|
public LightShader(){
|
||||||
|
super("light", "default");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply(){
|
||||||
|
setUniformf("u_ambient", ambient);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static class MenuShader extends LoadShader{
|
public static class MenuShader extends LoadShader{
|
||||||
float time = 0f;
|
float time = 0f;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package io.anuke.mindustry.ui.dialogs;
|
||||||
|
|
||||||
|
import io.anuke.arc.func.*;
|
||||||
|
import io.anuke.arc.graphics.*;
|
||||||
|
import io.anuke.arc.scene.ui.*;
|
||||||
|
import io.anuke.mindustry.gen.*;
|
||||||
|
import io.anuke.mindustry.graphics.*;
|
||||||
|
|
||||||
|
public class ColorPicker extends FloatingDialog{
|
||||||
|
private Cons<Color> cons = c -> {};
|
||||||
|
private Color current = new Color();
|
||||||
|
|
||||||
|
public ColorPicker(){
|
||||||
|
super("$pickcolor");
|
||||||
|
shown(this::setup);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void show(Color color, Cons<Color> consumer){
|
||||||
|
this.current.set(color);
|
||||||
|
this.cons = consumer;
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
cont.clear();
|
||||||
|
cont.pane(t -> {
|
||||||
|
t.table(Tex.pane, i -> {
|
||||||
|
i.stack(new Image(Tex.alphaBg), new Image(){{
|
||||||
|
setColor(current);
|
||||||
|
update(() -> setColor(current));
|
||||||
|
}}).size(200f);
|
||||||
|
}).colspan(2).padBottom(5);
|
||||||
|
|
||||||
|
float w = 150f;
|
||||||
|
|
||||||
|
t.row();
|
||||||
|
|
||||||
|
t.defaults().padBottom(4);
|
||||||
|
t.add("R").color(Pal.remove);
|
||||||
|
t.addSlider(0f, 1f, 0.01f, current.r, current::r).width(w);
|
||||||
|
t.row();
|
||||||
|
t.add("G").color(Color.lime);
|
||||||
|
t.addSlider(0f, 1f, 0.01f, current.g, current::g).width(w);
|
||||||
|
t.row();
|
||||||
|
t.add("B").color(Color.royal);
|
||||||
|
t.addSlider(0f, 1f, 0.01f, current.b, current::b).width(w);
|
||||||
|
t.row();
|
||||||
|
t.add("A");
|
||||||
|
t.addSlider(0f, 1f, 0.01f, current.a, current::a).width(w);
|
||||||
|
t.row();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
buttons.clear();
|
||||||
|
addCloseButton();
|
||||||
|
buttons.addImageTextButton("$ok", Icon.checkSmall, () -> {
|
||||||
|
cons.get(current);
|
||||||
|
hide();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -116,7 +116,7 @@ public class CustomRulesDialog extends FloatingDialog{
|
|||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
cont.clear();
|
cont.clear();
|
||||||
cont.pane(m -> main = m);
|
cont.pane(m -> main = m).get().setScrollingDisabled(true, false);
|
||||||
main.margin(10f);
|
main.margin(10f);
|
||||||
main.addButton("$settings.reset", () -> {
|
main.addButton("$settings.reset", () -> {
|
||||||
rules = resetter.get();
|
rules = resetter.get();
|
||||||
@@ -169,6 +169,20 @@ public class CustomRulesDialog extends FloatingDialog{
|
|||||||
check("$rules.attack", b -> rules.attackMode = b, () -> rules.attackMode);
|
check("$rules.attack", b -> rules.attackMode = b, () -> rules.attackMode);
|
||||||
check("$rules.enemyCheat", b -> rules.enemyCheat = b, () -> rules.enemyCheat);
|
check("$rules.enemyCheat", b -> rules.enemyCheat = b, () -> rules.enemyCheat);
|
||||||
number("$rules.enemycorebuildradius", f -> rules.enemyCoreBuildRadius = f * tilesize, () -> Math.min(rules.enemyCoreBuildRadius / tilesize, 200));
|
number("$rules.enemycorebuildradius", f -> rules.enemyCoreBuildRadius = f * tilesize, () -> Math.min(rules.enemyCoreBuildRadius / tilesize, 200));
|
||||||
|
|
||||||
|
title("$rules.title.experimental");
|
||||||
|
check("$rules.lighting", b -> rules.lighting = b, () -> rules.lighting);
|
||||||
|
|
||||||
|
main.addButton(b -> {
|
||||||
|
b.left();
|
||||||
|
b.table(Tex.pane, in -> {
|
||||||
|
in.stack(new Image(Tex.alphaBg), new Image(Tex.whiteui){{
|
||||||
|
update(() -> setColor(rules.ambientLight));
|
||||||
|
}}).grow();
|
||||||
|
}).margin(4).size(50f).padRight(10);
|
||||||
|
b.add("$rules.ambientlight");
|
||||||
|
}, () -> ui.picker.show(rules.ambientLight, rules.ambientLight::set)).left().width(250f);
|
||||||
|
main.row();
|
||||||
}
|
}
|
||||||
|
|
||||||
void number(String text, Floatc cons, Floatp prov){
|
void number(String text, Floatc cons, Floatp prov){
|
||||||
@@ -198,7 +212,9 @@ public class CustomRulesDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void title(String text){
|
void title(String text){
|
||||||
main.add(text).color(Pal.accent).padTop(20).padBottom(20).padRight(100f);
|
main.add(text).color(Pal.accent).padTop(20).padRight(100f).padBottom(-3);
|
||||||
|
main.row();
|
||||||
|
main.addImage().color(Pal.accent).height(3f).padRight(100f).padBottom(20);
|
||||||
main.row();
|
main.row();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class HostDialog extends FloatingDialog{
|
|||||||
}).grow().pad(8).get().setMaxLength(40);
|
}).grow().pad(8).get().setMaxLength(40);
|
||||||
|
|
||||||
ImageButton button = t.addImageButton(Tex.whiteui, Styles.clearFulli, 40, () -> {
|
ImageButton button = t.addImageButton(Tex.whiteui, Styles.clearFulli, 40, () -> {
|
||||||
new ColorPickDialog().show(color -> {
|
new PaletteDialog().show(color -> {
|
||||||
player.color.set(color);
|
player.color.set(color);
|
||||||
Core.settings.put("color-0", Color.rgba8888(color));
|
Core.settings.put("color-0", Color.rgba8888(color));
|
||||||
Core.settings.save();
|
Core.settings.save();
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ public class JoinDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImageButton button = t.addImageButton(Tex.whiteui, Styles.clearFulli, 40, () -> {
|
ImageButton button = t.addImageButton(Tex.whiteui, Styles.clearFulli, 40, () -> {
|
||||||
new ColorPickDialog().show(color -> {
|
new PaletteDialog().show(color -> {
|
||||||
player.color.set(color);
|
player.color.set(color);
|
||||||
Core.settings.put("color-0", Color.rgba8888(color));
|
Core.settings.put("color-0", Color.rgba8888(color));
|
||||||
Core.settings.save();
|
Core.settings.save();
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ import io.anuke.mindustry.ui.*;
|
|||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class ColorPickDialog extends Dialog{
|
public class PaletteDialog extends Dialog{
|
||||||
private Cons<Color> cons;
|
private Cons<Color> cons;
|
||||||
|
|
||||||
public ColorPickDialog(){
|
public PaletteDialog(){
|
||||||
super("");
|
super("");
|
||||||
build();
|
build();
|
||||||
}
|
}
|
||||||
@@ -292,6 +292,10 @@ public class Block extends BlockStorage{
|
|||||||
Draw.rect(region, tile.drawx(), tile.drawy(), rotate ? tile.rotation() * 90 : 0);
|
Draw.rect(region, tile.drawx(), tile.drawy(), rotate ? tile.rotation() * 90 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void drawLight(Tile tile){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void drawTeam(Tile tile){
|
public void drawTeam(Tile tile){
|
||||||
Draw.color(tile.getTeam().color);
|
Draw.color(tile.getTeam().color);
|
||||||
Draw.rect("block-border", tile.drawx() - size * tilesize / 2f + 4, tile.drawy() - size * tilesize / 2f + 4);
|
Draw.rect("block-border", tile.drawx() - size * tilesize / 2f + 4, tile.drawy() - size * tilesize / 2f + 4);
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ public abstract class BlockStorage extends UnlockableContent{
|
|||||||
|
|
||||||
other = other.block().getLiquidDestination(other, tile);
|
other = other.block().getLiquidDestination(other, tile);
|
||||||
|
|
||||||
if(other.getTeam() == tile.getTeam() && other.block().hasLiquids && canDumpLiquid(tile, other, liquid) && other.entity.liquids != null){
|
if(other != null && other.getTeam() == tile.getTeam() && other.block().hasLiquids && canDumpLiquid(tile, other, liquid) && other.entity.liquids != null){
|
||||||
float ofract = other.entity.liquids.get(liquid) / other.block().liquidCapacity;
|
float ofract = other.entity.liquids.get(liquid) / other.block().liquidCapacity;
|
||||||
float fract = tile.entity.liquids.get(liquid) / liquidCapacity;
|
float fract = tile.entity.liquids.get(liquid) / liquidCapacity;
|
||||||
|
|
||||||
|
|||||||
@@ -132,6 +132,11 @@ public class MendProjector extends Block{
|
|||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawLight(Tile tile){
|
||||||
|
renderer.lights.add(tile.drawx(), tile.drawy(), 50f * tile.entity.efficiency(), color, 0.7f * tile.entity.efficiency());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity newEntity(){
|
public TileEntity newEntity(){
|
||||||
return new MendEntity();
|
return new MendEntity();
|
||||||
|
|||||||
@@ -66,6 +66,11 @@ public class OverdriveProjector extends Block{
|
|||||||
stats.add(BlockStat.boostEffect, (int)((speedBoost + speedBoostPhase) * 100f), StatUnit.percent);
|
stats.add(BlockStat.boostEffect, (int)((speedBoost + speedBoostPhase) * 100f), StatUnit.percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawLight(Tile tile){
|
||||||
|
renderer.lights.add(tile.drawx(), tile.drawy(), 50f * tile.entity.efficiency(), color, 0.7f * tile.entity.efficiency());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Tile tile){
|
public void update(Tile tile){
|
||||||
OverdriveEntity entity = tile.entity();
|
OverdriveEntity entity = tile.entity();
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import io.anuke.mindustry.world.meta.*;
|
|||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.tilesize;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class ImpactReactor extends PowerGenerator{
|
public class ImpactReactor extends PowerGenerator{
|
||||||
protected int timerUse = timers++;
|
protected int timerUse = timers++;
|
||||||
@@ -116,6 +116,12 @@ public class ImpactReactor extends PowerGenerator{
|
|||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawLight(Tile tile){
|
||||||
|
float fract = tile.<FusionReactorEntity>entity().warmup;
|
||||||
|
renderer.lights.add(tile.drawx(), tile.drawy(), (110f + Mathf.absin(5, 5f)) * fract, Tmp.c1.set(plasma2).lerp(plasma1, Mathf.absin(7f, 0.2f)), 0.8f * fract);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TextureRegion[] generateIcons(){
|
public TextureRegion[] generateIcons(){
|
||||||
return new TextureRegion[]{Core.atlas.find(name + "-bottom"), Core.atlas.find(name)};
|
return new TextureRegion[]{Core.atlas.find(name + "-bottom"), Core.atlas.find(name)};
|
||||||
|
|||||||
@@ -174,6 +174,13 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawLight(Tile tile){
|
||||||
|
ItemLiquidGeneratorEntity entity = tile.entity();
|
||||||
|
|
||||||
|
renderer.lights.add(tile.drawx(), tile.drawy(), (60f + Mathf.absin(10f, 5f)) * entity.productionEfficiency * size, Color.orange, 0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
protected float getItemEfficiency(Item item){
|
protected float getItemEfficiency(Item item){
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package io.anuke.mindustry.world.blocks.power;
|
||||||
|
|
||||||
|
import io.anuke.arc.graphics.*;
|
||||||
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
|
import io.anuke.mindustry.world.*;
|
||||||
|
|
||||||
|
import static io.anuke.mindustry.Vars.renderer;
|
||||||
|
|
||||||
|
public class LightBlock extends Block{
|
||||||
|
protected Color color = Color.royal;
|
||||||
|
protected float brightness = 0.5f;
|
||||||
|
protected float radius = 200f;
|
||||||
|
protected int topRegion;
|
||||||
|
|
||||||
|
public LightBlock(String name){
|
||||||
|
super(name);
|
||||||
|
hasPower = true;
|
||||||
|
update = true;
|
||||||
|
topRegion = reg("-top");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Tile tile){
|
||||||
|
super.draw(tile);
|
||||||
|
Draw.blend(Blending.additive);
|
||||||
|
Draw.color(color, tile.entity.efficiency() * 0.3f);
|
||||||
|
Draw.rect(reg(topRegion), tile.drawx(), tile.drawy());
|
||||||
|
Draw.color();
|
||||||
|
Draw.blend();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawLight(Tile tile){
|
||||||
|
renderer.lights.add(tile.drawx(), tile.drawy(), radius, color, brightness * tile.entity.efficiency());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,6 +27,7 @@ public class NuclearReactor extends PowerGenerator{
|
|||||||
|
|
||||||
protected final Vector2 tr = new Vector2();
|
protected final Vector2 tr = new Vector2();
|
||||||
|
|
||||||
|
protected Color lightColor = Color.valueOf("7f19ea");
|
||||||
protected Color coolColor = new Color(1, 1, 1, 0f);
|
protected Color coolColor = new Color(1, 1, 1, 0f);
|
||||||
protected Color hotColor = Color.valueOf("ff9575a3");
|
protected Color hotColor = Color.valueOf("ff9575a3");
|
||||||
protected float itemDuration = 120; //time to consume 1 fuel
|
protected float itemDuration = 120; //time to consume 1 fuel
|
||||||
@@ -149,6 +150,13 @@ public class NuclearReactor extends PowerGenerator{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawLight(Tile tile){
|
||||||
|
NuclearReactorEntity entity = tile.entity();
|
||||||
|
float fract = entity.productionEfficiency;
|
||||||
|
renderer.lights.add(tile.drawx(), tile.drawy(), (90f + Mathf.absin(5, 5f)) * fract, Tmp.c1.set(lightColor).lerp(Color.scarlet, entity.heat), 0.6f * fract);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Tile tile){
|
public void draw(Tile tile){
|
||||||
super.draw(tile);
|
super.draw(tile);
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package io.anuke.mindustry.world.blocks.production;
|
package io.anuke.mindustry.world.blocks.production;
|
||||||
|
|
||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.*;
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.*;
|
||||||
import io.anuke.arc.graphics.g2d.*;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.util.Time;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.*;
|
||||||
|
|
||||||
|
import static io.anuke.mindustry.Vars.renderer;
|
||||||
|
|
||||||
/** A GenericCrafter with a new glowing region drawn on top. */
|
/** A GenericCrafter with a new glowing region drawn on top. */
|
||||||
public class GenericSmelter extends GenericCrafter{
|
public class GenericSmelter extends GenericCrafter{
|
||||||
@@ -45,4 +47,11 @@ public class GenericSmelter extends GenericCrafter{
|
|||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawLight(Tile tile){
|
||||||
|
GenericCrafterEntity entity = tile.entity();
|
||||||
|
|
||||||
|
renderer.lights.add(tile.drawx(), tile.drawy(), (60f + Mathf.absin(10f, 5f)) * entity.warmup * size, flameColor, 0.65f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,11 @@ public class CoreBlock extends StorageBlock{
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawLight(Tile tile){
|
||||||
|
renderer.lights.add(tile.drawx(), tile.drawy(), 30f * size, Pal.accent, 0.5f + Mathf.absin(20f, 0.1f));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||||
return tile.entity.items.get(item) < getMaximumAccepted(tile, item);
|
return tile.entity.items.get(item) < getMaximumAccepted(tile, item);
|
||||||
|
|||||||