Merge branch 'master' into crater
# Conflicts: # core/assets/sprites/sprites.atlas # core/assets/sprites/sprites.png # core/assets/sprites/sprites2.png # core/assets/sprites/sprites3.png
This commit is contained in:
@@ -34,4 +34,9 @@ class AllDefs{
|
||||
class sync{
|
||||
|
||||
}
|
||||
|
||||
@GroupDef(Drawc.class)
|
||||
class draw{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package mindustry.entities.def;
|
||||
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
@@ -11,7 +12,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;
|
||||
@@ -109,6 +110,8 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
Draw.z(Layer.bullet);
|
||||
|
||||
type.draw(this);
|
||||
//TODO refactor
|
||||
renderer.lights.add(x(), y(), 16f, Pal.powerLight, 0.3f);
|
||||
|
||||
@@ -8,14 +8,14 @@ import mindustry.gen.*;
|
||||
|
||||
@EntityDef(value = {Decalc.class}, pooled = true)
|
||||
@Component
|
||||
abstract class DecalComp implements Drawc, Timedc, Rotc, Posc, DrawLayerFloorc{
|
||||
abstract class DecalComp implements Drawc, Timedc, Rotc, Posc{
|
||||
@Import float x, y, rotation;
|
||||
|
||||
Color color = new Color(1, 1, 1, 1);
|
||||
TextureRegion region;
|
||||
|
||||
@Override
|
||||
public void drawFloor(){
|
||||
public void draw(){
|
||||
Draw.color(color);
|
||||
Draw.alpha(1f - Mathf.curve(fin(), 0.98f));
|
||||
Draw.rect(region, x, y, rotation);
|
||||
|
||||
@@ -6,4 +6,8 @@ import mindustry.gen.*;
|
||||
@Component
|
||||
abstract class DrawComp implements Posc{
|
||||
abstract float clipSize();
|
||||
|
||||
void draw(){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
package mindustry.entities.def;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
|
||||
@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(){
|
||||
Draw.z(Layer.effect);
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import mindustry.annotations.Annotations.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
@Component
|
||||
abstract class LegsComp implements Posc, Flyingc, Hitboxc, DrawLayerGroundUnderc, Unitc, Legsc, ElevationMovec{
|
||||
abstract class LegsComp implements Posc, Flyingc, Hitboxc, Unitc, Legsc, ElevationMovec{
|
||||
@Import float x, y;
|
||||
|
||||
float baseRotation;
|
||||
@@ -18,9 +18,4 @@ abstract class LegsComp implements Posc, Flyingc, Hitboxc, DrawLayerGroundUnderc
|
||||
baseRotation = Angles.moveToward(baseRotation, vel().angle(), type().baseRotateSpeed * Mathf.clamp(len / type().speed));
|
||||
walkTime += Time.delta()*len/1f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGroundUnder(){
|
||||
type().drawLegs(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import mindustry.world.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@Component
|
||||
abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, DrawLayerGroundc{
|
||||
abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc{
|
||||
@Import float x, y, rotation;
|
||||
|
||||
transient float mineTimer;
|
||||
@@ -80,7 +80,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, DrawLayerGroundc{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGround(){
|
||||
public void draw(){
|
||||
if(!mining()) return;
|
||||
float focusLen = 4f + Mathf.absin(Time.time(), 1.1f, 0.5f);
|
||||
float swingScl = 12f, swingMag = tilesize / 8f;
|
||||
|
||||
@@ -13,6 +13,7 @@ import mindustry.core.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.net.Administration.*;
|
||||
import mindustry.net.*;
|
||||
import mindustry.net.Packets.*;
|
||||
@@ -23,7 +24,7 @@ import static mindustry.Vars.*;
|
||||
|
||||
@EntityDef(value = {Playerc.class}, serialize = false)
|
||||
@Component
|
||||
abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc{
|
||||
abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Drawc{
|
||||
@NonNull @ReadOnly Unitc unit = Nulls.unit;
|
||||
|
||||
@ReadOnly Team team = Team.sharded;
|
||||
@@ -58,6 +59,12 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float clipSize(){
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
if(unit.dead()){
|
||||
clearUnit();
|
||||
@@ -130,7 +137,10 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc{
|
||||
con.kick(reason);
|
||||
}
|
||||
|
||||
void drawName(){
|
||||
@Override
|
||||
public void draw(){
|
||||
Draw.z(Layer.playerName);
|
||||
|
||||
BitmapFont font = Fonts.def;
|
||||
GlyphLayout layout = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
|
||||
final float nameHeight = 11;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -615,12 +615,6 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
|
||||
}
|
||||
}
|
||||
|
||||
public void drawLayer(){
|
||||
}
|
||||
|
||||
public void drawLayer2(){
|
||||
}
|
||||
|
||||
public void drawCracks(){
|
||||
if(!damaged() || block.size > Block.maxCrackSize) return;
|
||||
int id = pos();
|
||||
@@ -824,7 +818,7 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
|
||||
l.clearChildren();
|
||||
for(Item item : content.items()){
|
||||
if(items.flownBits() != null && items.flownBits().get(item.id)){
|
||||
l.addImage(item.icon(Cicon.small)).padRight(3f);
|
||||
l.image(item.icon(Cicon.small)).padRight(3f);
|
||||
l.label(() -> items.getFlowRate(item) < 0 ? "..." : Strings.fixed(items.getFlowRate(item), 1) + ps).color(Color.lightGray);
|
||||
l.row();
|
||||
}
|
||||
@@ -845,7 +839,7 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
|
||||
table.row();
|
||||
table.table(l -> {
|
||||
l.left();
|
||||
l.addImage(() -> liquids.current().icon(Cicon.small)).padRight(3f);
|
||||
l.image(() -> liquids.current().icon(Cicon.small)).padRight(3f);
|
||||
l.label(() -> liquids.getFlowRate() < 0 ? "..." : Strings.fixed(liquids.getFlowRate(), 2) + ps).color(Color.lightGray);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -18,8 +18,7 @@ import mindustry.world.blocks.environment.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@Component
|
||||
abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitboxc, Rotc, Massc, Unitc, Weaponsc, Drawc, Boundedc,
|
||||
DrawLayerGroundc, DrawLayerFlyingc, DrawLayerGroundShadowsc, DrawLayerFlyingShadowsc, Syncc{
|
||||
abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitboxc, Rotc, Massc, Unitc, Weaponsc, Drawc, Boundedc, Syncc{
|
||||
@Import float x, y, rotation, elevation;
|
||||
|
||||
private UnitController controller;
|
||||
@@ -172,32 +171,7 @@ abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitbox
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
type.drawEngine(this);
|
||||
type.drawBody(this);
|
||||
type.drawWeapons(this);
|
||||
if(type.drawCell) type.drawCell(this);
|
||||
if(type.drawItems) type.drawItems(this);
|
||||
type.drawLight(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFlyingShadows(){
|
||||
if(isFlying()) type.drawShadow(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGroundShadows(){
|
||||
type.drawOcclusion(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFlying(){
|
||||
if(isFlying()) draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGround(){
|
||||
if(isGrounded()) draw();
|
||||
type.draw(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user