diff --git a/annotations/src/main/java/mindustry/annotations/BaseProcessor.java b/annotations/src/main/java/mindustry/annotations/BaseProcessor.java index 4b188a760e..f66a5aa302 100644 --- a/annotations/src/main/java/mindustry/annotations/BaseProcessor.java +++ b/annotations/src/main/java/mindustry/annotations/BaseProcessor.java @@ -161,10 +161,10 @@ public abstract class BaseProcessor extends AbstractProcessor{ filer = env.getFiler(); messager = env.getMessager(); - //System.setProperty("debug", "true"); + Log.setLogLevel(LogLevel.info); - if(System.getProperty("debug") == null){ - Log.setLogLevel(LogLevel.err); + if(System.getProperty("debug") != null){ + Log.setLogLevel(LogLevel.debug); } } diff --git a/annotations/src/main/java/mindustry/annotations/impl/EntityProcess.java b/annotations/src/main/java/mindustry/annotations/impl/EntityProcess.java index 1df120f5bf..1d80e46c61 100644 --- a/annotations/src/main/java/mindustry/annotations/impl/EntityProcess.java +++ b/annotations/src/main/java/mindustry/annotations/impl/EntityProcess.java @@ -142,18 +142,18 @@ public class EntityProcess extends BaseProcessor{ //LOGGING - Log.info("&gGenerating interface for " + component.name()); + Log.debug("&gGenerating interface for " + component.name()); for(TypeName tn : inter.superinterfaces){ - Log.info("&g> &lbextends {0}", simpleName(tn.toString())); + Log.debug("&g> &lbextends {0}", simpleName(tn.toString())); } //log methods generated for(MethodSpec spec : inter.methodSpecs){ - Log.info("&g> > &c{0} {1}({2})", simpleName(spec.returnType.toString()), spec.name, Array.with(spec.parameters).toString(", ", p -> simpleName(p.type.toString()) + " " + p.name)); + Log.debug("&g> > &c{0} {1}({2})", simpleName(spec.returnType.toString()), spec.name, Array.with(spec.parameters).toString(", ", p -> simpleName(p.type.toString()) + " " + p.name)); } - Log.info(""); + Log.debug(""); } //generate special render layer interfaces diff --git a/annotations/src/main/java/mindustry/annotations/util/Selement.java b/annotations/src/main/java/mindustry/annotations/util/Selement.java index d1f3e38e19..def6b001e9 100644 --- a/annotations/src/main/java/mindustry/annotations/util/Selement.java +++ b/annotations/src/main/java/mindustry/annotations/util/Selement.java @@ -18,6 +18,10 @@ public class Selement{ this.e = e; } + public Array> enclosed(){ + return Array.with(e.getEnclosedElements()).map(Selement::new); + } + public String fullName(){ return e.toString(); } diff --git a/core/src/mindustry/ctype/ContentType.java b/core/src/mindustry/ctype/ContentType.java index de80c859bd..2c8faaa1ff 100644 --- a/core/src/mindustry/ctype/ContentType.java +++ b/core/src/mindustry/ctype/ContentType.java @@ -4,7 +4,7 @@ package mindustry.ctype; public enum ContentType{ item, block, - mech, + mech_UNUSED, bullet, liquid, status, diff --git a/core/src/mindustry/entities/AllEntities.java b/core/src/mindustry/entities/AllEntities.java index 26e645d589..b279e020c2 100644 --- a/core/src/mindustry/entities/AllEntities.java +++ b/core/src/mindustry/entities/AllEntities.java @@ -17,7 +17,7 @@ class AllEntities{ @EntityDef(value = {GroundEffectc.class, Childc.class}, pooled = true) class GroundEffectDef{} - @EntityDef({Decalc.class}) + @EntityDef(value = {Decalc.class}, pooled = true) class DecalDef{} @EntityDef({Playerc.class}) diff --git a/core/src/mindustry/entities/Effect.java b/core/src/mindustry/entities/Effect.java index d52a8caeb7..b1dd73ed69 100644 --- a/core/src/mindustry/entities/Effect.java +++ b/core/src/mindustry/entities/Effect.java @@ -42,35 +42,35 @@ public class Effect{ } public void at(Position pos){ - Effects.createEffect(this, pos.getX(), pos.getY(), 0, Color.white, null); + Effects.create(this, pos.getX(), pos.getY(), 0, Color.white, null); } public void at(Position pos, float rotation){ - Effects.createEffect(this, pos.getX(), pos.getY(), rotation, Color.white, null); + Effects.create(this, pos.getX(), pos.getY(), rotation, Color.white, null); } public void at(float x, float y){ - Effects.createEffect(this, x, y, 0, Color.white, null); + Effects.create(this, x, y, 0, Color.white, null); } public void at(float x, float y, float rotation){ - Effects.createEffect(this, x, y, rotation, Color.white, null); + Effects.create(this, x, y, rotation, Color.white, null); } public void at(float x, float y, float rotation, Color color){ - Effects.createEffect(this, x, y, rotation, color, null); + Effects.create(this, x, y, rotation, color, null); } public void at(float x, float y, Color color){ - Effects.createEffect(this, x, y, 0, color, null); + Effects.create(this, x, y, 0, color, null); } public void at(float x, float y, float rotation, Color color, Object data){ - Effects.createEffect(this, x, y, rotation, color, data); + Effects.create(this, x, y, rotation, color, data); } public void at(float x, float y, float rotation, Object data){ - Effects.createEffect(this, x, y, rotation, Color.white, data); + Effects.create(this, x, y, rotation, Color.white, data); } public void render(int id, Color color, float life, float rotation, float x, float y, Object data){ diff --git a/core/src/mindustry/entities/Effects.java b/core/src/mindustry/entities/Effects.java index 3d7f94a456..21361c5fcb 100644 --- a/core/src/mindustry/entities/Effects.java +++ b/core/src/mindustry/entities/Effects.java @@ -2,11 +2,13 @@ package mindustry.entities; import arc.*; import arc.graphics.*; +import arc.graphics.g2d.*; import arc.math.*; import arc.math.geom.*; import arc.util.*; import mindustry.content.*; import mindustry.gen.*; +import mindustry.graphics.*; import static mindustry.Vars.*; @@ -32,7 +34,7 @@ public class Effects{ shake(intensity, duration, loc.getX(), loc.getY()); } - public static void createEffect(Effect effect, float x, float y, float rotation, Color color, Object data){ + public static void create(Effect effect, float x, float y, float rotation, Color color, Object data){ if(headless || effect == Fx.none) return; if(Core.settings.getBool("effects")){ Rect view = Core.camera.bounds(Tmp.r1); @@ -51,4 +53,25 @@ public class Effects{ } } } + + public static void decal(TextureRegion region, float x, float y, float rotation, float lifetime, Color color){ + if(headless || region == null) return; + + Decalc decal = DecalEntity.create(); + decal.set(x, y); + decal.rotation(rotation); + decal.lifetime(lifetime); + decal.color().set(color); + decal.region(region); + decal.add(); + } + + public static void rubble(float x, float y, int blockSize){ + if(headless) return; + + TextureRegion region = Core.atlas.find("rubble-" + blockSize + "-" + Mathf.random(0, 1)); + if(!Core.atlas.isFound(region)) return; + + decal(region, x, y, Mathf.random(0, 4) * 90, 3600, Pal.rubble); + } } diff --git a/core/src/mindustry/entities/def/DecalComp.java b/core/src/mindustry/entities/def/DecalComp.java index c9a208366c..d6f8ea012b 100644 --- a/core/src/mindustry/entities/def/DecalComp.java +++ b/core/src/mindustry/entities/def/DecalComp.java @@ -2,18 +2,22 @@ package mindustry.entities.def; import arc.graphics.*; import arc.graphics.g2d.*; +import arc.math.*; import mindustry.annotations.Annotations.*; import mindustry.gen.*; @Component abstract class DecalComp implements Drawc, Timedc, Rotc, Posc, DrawLayerFloorc{ + transient float x, y, rotation; + Color color = new Color(1, 1, 1, 1); TextureRegion region; @Override public void drawFloor(){ Draw.color(color); - Draw.rect(region, x(), y(), rotation()); + Draw.alpha(1f - Mathf.curve(fin(), 0.98f)); + Draw.rect(region, x, y, rotation); Draw.color(); } diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 3cebc54660..e8f679cfa4 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -640,8 +640,7 @@ public class Block extends BlockStorage{ Damage.dynamicExplosion(x, y, flammability, explosiveness * 3.5f, power, tilesize * size / 2f, Pal.darkFlame); if(!tile.floor().solid && !tile.floor().isLiquid){ - //TODO rubble decal - //RubbleDecal.create(tile.drawx(), tile.drawy(), size); + Effects.rubble(tile.drawx(), tile.drawy(), size); } } diff --git a/core/src/mindustry/world/blocks/BuildBlock.java b/core/src/mindustry/world/blocks/BuildBlock.java index 7cb2a4917f..7f40261a5a 100644 --- a/core/src/mindustry/world/blocks/BuildBlock.java +++ b/core/src/mindustry/world/blocks/BuildBlock.java @@ -9,6 +9,7 @@ import arc.util.ArcAnnotate.*; import arc.util.*; import mindustry.annotations.Annotations.*; import mindustry.content.*; +import mindustry.entities.*; import mindustry.game.EventType.*; import mindustry.game.*; import mindustry.gen.*; @@ -156,8 +157,7 @@ public class BuildBlock extends Block{ Fx.blockExplosionSmoke.at(tile); if(!tile.floor().solid && !tile.floor().isLiquid){ - //TODO implement - // RubbleDecal.create(tile.drawx(), tile.drawy(), size); + Effects.rubble(tile.drawx(), tile.drawy(), size); } }