This commit is contained in:
Anuken
2020-04-23 00:03:03 -04:00
parent 6cf422eebf
commit 362846bd68
19 changed files with 46 additions and 80 deletions
@@ -4,6 +4,7 @@ dagger=0
draug=10
mindustry.entities.def.BulletComp=1
mindustry.entities.def.DecalComp=2
mindustry.entities.def.EffectComp=15
mindustry.entities.def.FireComp=3
mindustry.entities.def.GroundEffectComp=4
mindustry.entities.def.PlayerComp=5
@@ -0,0 +1 @@
{fields:[{name:color,type:arc.graphics.Color,size:-1},{name:data,type:java.lang.Object,size:-1},{name:lifetime,type:float,size:4},{name:offsetX,type:float,size:4},{name:offsetY,type:float,size:4},{name:rotation,type:float,size:4},{name:time,type:float,size:4},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
-2
View File
@@ -208,8 +208,6 @@ public class Renderer implements ApplicationListener{
blocks.floor.drawLayer(CacheLayer.walls);
blocks.floor.endDraw();
blocks.drawBlocks();
//draw stuff
+1 -1
View File
@@ -42,7 +42,7 @@ public class Effects{
Rect pos = Tmp.r2.setSize(effect.size).setCenter(x, y);
if(view.overlaps(pos)){
Effectc entity = effect.ground ? GroundEffectEntity.create() : StandardEffectEntity.create();
Effectc entity = EffectEntity.create();
entity.effect(effect);
entity.rotation(rotation);
entity.data(data);
@@ -23,7 +23,7 @@ import java.util.*;
import static mindustry.Vars.*;
@Component
abstract class BuilderComp implements Unitc, DrawLayerFlyingc{
abstract class BuilderComp implements Unitc{
static final Vec2[] vecs = new Vec2[]{new Vec2(), new Vec2(), new Vec2(), new Vec2()};
@Import float x, y, rotation;
@@ -197,8 +197,12 @@ abstract class BuilderComp implements Unitc, DrawLayerFlyingc{
}
@Override
public void drawFlying(){
public void draw(){
if(!isBuilding()) return;
//TODO check correctness
Draw.z(Layer.flyingUnit);
BuildRequest request = buildRequest();
Tile tile = world.tile(request.x, request.y);
@@ -11,7 +11,7 @@ import static mindustry.Vars.*;
@EntityDef(value = {Bulletc.class}, pooled = true)
@Component
abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Drawc, Shielderc, Ownerc, Velc, Bulletc, Timerc, DrawLayerBulletsc{
abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Drawc, Shielderc, Ownerc, Velc, Bulletc, Timerc{
Object data;
BulletType type;
float damage;
@@ -5,13 +5,15 @@ import mindustry.annotations.Annotations.*;
import mindustry.entities.*;
import mindustry.gen.*;
@EntityDef(value = {Effectc.class, Childc.class}, pooled = true)
@Component
abstract class EffectComp implements Posc, Drawc, Timedc, Rotc, Childc{
Color color = new Color(Color.white);
Effect effect;
Object data;
void draw(){
@Override
public void draw(){
effect.render(id(), color, time(), rotation(), x(), y(), data);
}
@@ -1,14 +0,0 @@
package mindustry.entities.def;
import mindustry.annotations.Annotations.*;
import mindustry.gen.*;
@EntityDef(value = {GroundEffectc.class, Childc.class}, pooled = true)
@Component
abstract class GroundEffectComp implements Effectc, DrawLayerFloorOverc{
@Override
public void drawFloorOver(){
draw();
}
}
@@ -10,6 +10,7 @@ import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.entities.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.type.*;
import mindustry.world.*;
@@ -18,7 +19,7 @@ import static mindustry.entities.Puddles.maxLiquid;
@EntityDef(value = {Puddlec.class}, pooled = true)
@Component
abstract class PuddleComp implements Posc, DrawLayerFloorOverc, Puddlec{
abstract class PuddleComp implements Posc, Puddlec{
private static final int maxGeneration = 2;
private static final Color tmp = new Color();
private static final Rect rect = new Rect();
@@ -89,7 +90,9 @@ abstract class PuddleComp implements Posc, DrawLayerFloorOverc, Puddlec{
}
@Override
public void drawFloorOver(){
public void draw(){
Draw.z(Layer.debris - 1);
seeds = id();
boolean onLiquid = tile.floor().isLiquid;
float f = Mathf.clamp(amount / (maxLiquid / 1.5f));
@@ -1,14 +0,0 @@
package mindustry.entities.def;
import mindustry.annotations.Annotations.*;
import mindustry.gen.*;
@EntityDef(value = {StandardEffectc.class, Childc.class}, pooled = true)
@Component
abstract class StandardEffectComp implements Effectc, DrawLayerEffectsc{
@Override
public void drawEffects(){
draw();
}
}
+3
View File
@@ -20,6 +20,9 @@ public class Layer{
//base block layer - most blocks go here
block = 30,
//things drawn over blocks (intermediate layer)
blockOver = 35,
//blocks currently in progress *shaders used* TODO perhaps put shaders into their own category
blockBuilding = 40,
+5 -2
View File
@@ -1,9 +1,11 @@
package mindustry.type;
import arc.func.*;
import arc.graphics.g2d.*;
import mindustry.annotations.Annotations.*;
import mindustry.ctype.*;
import mindustry.gen.*;
import mindustry.graphics.*;
public abstract class Weather extends MappableContent{
protected float duration = 100f;
@@ -39,7 +41,7 @@ public abstract class Weather extends MappableContent{
@EntityDef(value = {Weatherc.class}, pooled = true, isFinal = false)
@Component
abstract class WeatherComp implements Posc, DrawLayerWeatherc{
abstract class WeatherComp implements Posc, Drawc{
Weather weather;
void init(Weather weather){
@@ -47,7 +49,8 @@ public abstract class Weather extends MappableContent{
}
@Override
public void drawWeather(){
public void draw(){
Draw.z(Layer.weather);
weather.draw();
}
-8
View File
@@ -199,14 +199,6 @@ public class Block extends UnlockableContent{
return sum / size / size;
}
public void drawLayer(Tile tile){
if(tile.entity != null) tile.entity.drawLayer();
}
public void drawLayer2(Tile tile){
if(tile.entity != null) tile.entity.drawLayer2();
}
/** Drawn when you are placing a block. */
public void drawPlace(int x, int y, int rotation, boolean valid){
}
@@ -22,21 +22,11 @@ public class ShockMine extends Block{
destructible = true;
solid = false;
targetable = false;
layer = Layer.overlay;
rebuildable = false;
}
public class ShockMineEntity extends TileEntity{
@Override
public void drawLayer(){
super.draw();
Draw.color(team.color);
Draw.alpha(0.22f);
Fill.rect(x, y, 2f, 2f);
Draw.color();
}
@Override
public void drawTeam(){
//no
@@ -44,7 +34,11 @@ public class ShockMine extends Block{
@Override
public void draw(){
//nope
super.draw();
Draw.color(team.color);
Draw.alpha(0.22f);
Fill.rect(x, y, 2f, 2f);
Draw.color();
}
@Override
@@ -10,8 +10,8 @@ import arc.util.ArcAnnotate.*;
import arc.util.*;
import arc.util.io.*;
import mindustry.content.*;
import mindustry.gen.*;
import mindustry.entities.units.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.type.*;
import mindustry.ui.*;
@@ -36,7 +36,6 @@ public class Conveyor extends Block implements Autotiler{
super(name);
rotate = true;
update = true;
layer = Layer.overlay;
group = BlockGroup.transportation;
hasItems = true;
itemCapacity = 4;
@@ -127,6 +126,19 @@ public class Conveyor extends Block implements Autotiler{
int frame = clogHeat <= 0.5f ? (int)(((Time.time() * speed * 8f * timeScale())) % 4) : 0;
Draw.rect(regions[Mathf.clamp(blendbits, 0, regions.length - 1)][Mathf.clamp(frame, 0, regions[0].length - 1)], x, y,
tilesize * blendsclx, tilesize * blendscly, rotation * 90);
//TODO is clustering necessary? does it create garbage?
Draw.z(Layer.blockOver);
for(int i = 0; i < len; i++){
Item item = ids[i];
tr1.trns(rotation * 90, tilesize, 0);
tr2.trns(rotation * 90, -tilesize / 2f, xs[i] * tilesize / 2f);
Draw.rect(item.icon(Cicon.medium),
(tile.x * tilesize + tr1.x * ys[i] + tr2.x),
(tile.y * tilesize + tr1.y * ys[i] + tr2.y), itemSize, itemSize);
}
}
@Override
@@ -150,21 +162,6 @@ public class Conveyor extends Block implements Autotiler{
}
}
@Override
public void drawLayer(){
byte rotation = tile.rotation();
for(int i = 0; i < len; i++){
Item item = ids[i];
tr1.trns(rotation * 90, tilesize, 0);
tr2.trns(rotation * 90, -tilesize / 2f, xs[i] * tilesize / 2f);
Draw.rect(item.icon(Cicon.medium),
(tile.x * tilesize + tr1.x * ys[i] + tr2.x),
(tile.y * tilesize + tr1.y * ys[i] + tr2.y), itemSize, itemSize);
}
}
@Override
public void unitOn(Unitc unit){
if(clogHeat > 0.5f){
@@ -32,7 +32,6 @@ public class ItemBridge extends Block{
update = true;
solid = true;
hasPower = true;
layer = Layer.power;
expanded = true;
itemCapacity = 10;
configurable = true;
@@ -375,8 +375,6 @@ public class PowerNode extends PowerBlock{
public void drawLayer(){
if(Core.settings.getInt("lasersopacity") == 0) return;
Tilec entity = tile.ent();
for(int i = 0; i < power.links.size; i++){
Tilec link = world.ent(power.links.get(i));
@@ -31,7 +31,6 @@ public class CoreBlock extends StorageBlock{
flags = EnumSet.of(BlockFlag.core, BlockFlag.producer);
activeSound = Sounds.respawning;
activeSoundVolume = 1f;
layer = Layer.overlay;
}
@Remote(called = Loc.server)
+1 -1
View File
@@ -1,3 +1,3 @@
org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=67f230afedd76d2d12ba3bb3e07116f8f0edd526
archash=7c888f92ae770e9dc3b07439c32f64cc67c2a6a6