Feature re-implementations

This commit is contained in:
Anuken
2020-02-08 21:54:41 -05:00
parent 5169e197b6
commit e23119e330
10 changed files with 53 additions and 23 deletions

View File

@@ -161,10 +161,10 @@ public abstract class BaseProcessor extends AbstractProcessor{
filer = env.getFiler(); filer = env.getFiler();
messager = env.getMessager(); messager = env.getMessager();
//System.setProperty("debug", "true"); Log.setLogLevel(LogLevel.info);
if(System.getProperty("debug") == null){ if(System.getProperty("debug") != null){
Log.setLogLevel(LogLevel.err); Log.setLogLevel(LogLevel.debug);
} }
} }

View File

@@ -142,18 +142,18 @@ public class EntityProcess extends BaseProcessor{
//LOGGING //LOGGING
Log.info("&gGenerating interface for " + component.name()); Log.debug("&gGenerating interface for " + component.name());
for(TypeName tn : inter.superinterfaces){ for(TypeName tn : inter.superinterfaces){
Log.info("&g> &lbextends {0}", simpleName(tn.toString())); Log.debug("&g> &lbextends {0}", simpleName(tn.toString()));
} }
//log methods generated //log methods generated
for(MethodSpec spec : inter.methodSpecs){ 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 //generate special render layer interfaces

View File

@@ -18,6 +18,10 @@ public class Selement<T extends Element>{
this.e = e; this.e = e;
} }
public Array<Selement<?>> enclosed(){
return Array.with(e.getEnclosedElements()).map(Selement::new);
}
public String fullName(){ public String fullName(){
return e.toString(); return e.toString();
} }

View File

@@ -4,7 +4,7 @@ package mindustry.ctype;
public enum ContentType{ public enum ContentType{
item, item,
block, block,
mech, mech_UNUSED,
bullet, bullet,
liquid, liquid,
status, status,

View File

@@ -17,7 +17,7 @@ class AllEntities{
@EntityDef(value = {GroundEffectc.class, Childc.class}, pooled = true) @EntityDef(value = {GroundEffectc.class, Childc.class}, pooled = true)
class GroundEffectDef{} class GroundEffectDef{}
@EntityDef({Decalc.class}) @EntityDef(value = {Decalc.class}, pooled = true)
class DecalDef{} class DecalDef{}
@EntityDef({Playerc.class}) @EntityDef({Playerc.class})

View File

@@ -42,35 +42,35 @@ public class Effect{
} }
public void at(Position pos){ 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){ 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){ 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){ 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){ 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){ 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){ 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){ 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){ public void render(int id, Color color, float life, float rotation, float x, float y, Object data){

View File

@@ -2,11 +2,13 @@ package mindustry.entities;
import arc.*; import arc.*;
import arc.graphics.*; import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*; import arc.math.*;
import arc.math.geom.*; import arc.math.geom.*;
import arc.util.*; import arc.util.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.graphics.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
@@ -32,7 +34,7 @@ public class Effects{
shake(intensity, duration, loc.getX(), loc.getY()); 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(headless || effect == Fx.none) return;
if(Core.settings.getBool("effects")){ if(Core.settings.getBool("effects")){
Rect view = Core.camera.bounds(Tmp.r1); 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);
}
} }

View File

@@ -2,18 +2,22 @@ package mindustry.entities.def;
import arc.graphics.*; import arc.graphics.*;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.math.*;
import mindustry.annotations.Annotations.*; import mindustry.annotations.Annotations.*;
import mindustry.gen.*; import mindustry.gen.*;
@Component @Component
abstract class DecalComp implements Drawc, Timedc, Rotc, Posc, DrawLayerFloorc{ abstract class DecalComp implements Drawc, Timedc, Rotc, Posc, DrawLayerFloorc{
transient float x, y, rotation;
Color color = new Color(1, 1, 1, 1); Color color = new Color(1, 1, 1, 1);
TextureRegion region; TextureRegion region;
@Override @Override
public void drawFloor(){ public void drawFloor(){
Draw.color(color); 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(); Draw.color();
} }

View File

@@ -640,8 +640,7 @@ public class Block extends BlockStorage{
Damage.dynamicExplosion(x, y, flammability, explosiveness * 3.5f, power, tilesize * size / 2f, Pal.darkFlame); Damage.dynamicExplosion(x, y, flammability, explosiveness * 3.5f, power, tilesize * size / 2f, Pal.darkFlame);
if(!tile.floor().solid && !tile.floor().isLiquid){ if(!tile.floor().solid && !tile.floor().isLiquid){
//TODO rubble decal Effects.rubble(tile.drawx(), tile.drawy(), size);
//RubbleDecal.create(tile.drawx(), tile.drawy(), size);
} }
} }

View File

@@ -9,6 +9,7 @@ import arc.util.ArcAnnotate.*;
import arc.util.*; import arc.util.*;
import mindustry.annotations.Annotations.*; import mindustry.annotations.Annotations.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.entities.*;
import mindustry.game.EventType.*; import mindustry.game.EventType.*;
import mindustry.game.*; import mindustry.game.*;
import mindustry.gen.*; import mindustry.gen.*;
@@ -156,8 +157,7 @@ public class BuildBlock extends Block{
Fx.blockExplosionSmoke.at(tile); Fx.blockExplosionSmoke.at(tile);
if(!tile.floor().solid && !tile.floor().isLiquid){ if(!tile.floor().solid && !tile.floor().isLiquid){
//TODO implement Effects.rubble(tile.drawx(), tile.drawy(), size);
// RubbleDecal.create(tile.drawx(), tile.drawy(), size);
} }
} }