diff --git a/core/assets/maps/groundZero.msav b/core/assets/maps/groundZero.msav index 3221c69b19..3582329a66 100644 Binary files a/core/assets/maps/groundZero.msav and b/core/assets/maps/groundZero.msav differ diff --git a/core/src/io/anuke/mindustry/entities/type/BaseUnit.java b/core/src/io/anuke/mindustry/entities/type/BaseUnit.java index a0ce31d3b7..e6c182d029 100644 --- a/core/src/io/anuke/mindustry/entities/type/BaseUnit.java +++ b/core/src/io/anuke/mindustry/entities/type/BaseUnit.java @@ -1,30 +1,23 @@ package io.anuke.mindustry.entities.type; import io.anuke.annotations.Annotations.*; -import io.anuke.arc.Core; -import io.anuke.arc.graphics.g2d.Draw; -import io.anuke.arc.graphics.g2d.TextureRegion; -import io.anuke.arc.math.Angles; -import io.anuke.arc.math.Mathf; -import io.anuke.arc.math.geom.Geometry; -import io.anuke.arc.math.geom.Rectangle; -import io.anuke.arc.util.Interval; -import io.anuke.arc.util.Time; -import io.anuke.mindustry.Vars; -import io.anuke.mindustry.content.StatusEffects; -import io.anuke.mindustry.entities.EntityGroup; -import io.anuke.mindustry.entities.Units; -import io.anuke.mindustry.entities.traits.ShooterTrait; -import io.anuke.mindustry.entities.traits.TargetTrait; +import io.anuke.arc.*; +import io.anuke.arc.graphics.g2d.*; +import io.anuke.arc.math.*; +import io.anuke.arc.math.geom.*; +import io.anuke.arc.util.*; +import io.anuke.mindustry.*; +import io.anuke.mindustry.content.*; +import io.anuke.mindustry.entities.*; +import io.anuke.mindustry.entities.traits.*; import io.anuke.mindustry.entities.units.*; -import io.anuke.mindustry.game.Team; -import io.anuke.mindustry.game.TypeID; -import io.anuke.mindustry.gen.Call; +import io.anuke.mindustry.game.*; +import io.anuke.mindustry.gen.*; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.type.*; -import io.anuke.mindustry.world.Tile; -import io.anuke.mindustry.world.blocks.units.UnitFactory.UnitFactoryEntity; -import io.anuke.mindustry.world.meta.BlockFlag; +import io.anuke.mindustry.world.*; +import io.anuke.mindustry.world.blocks.units.UnitFactory.*; +import io.anuke.mindustry.world.meta.*; import java.io.*; @@ -168,22 +161,6 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{ return null; } - protected void drawItems(){ - float backTrns = 4f; - if(item.amount > 0){ - int stored = Mathf.clamp(item.amount / 6, 1, 8); - - for(int i = 0; i < stored; i++){ - float angT = i == 0 ? 0 : Mathf.randomSeedRange(i + 2, 60f); - float lenT = i == 0 ? 0 : Mathf.randomSeedRange(i + 3, 1f) - 1f; - Draw.rect(item.item.icon(Item.Icon.large), - x + Angles.trnsx(rotation + 180f + angT, backTrns + lenT), - y + Angles.trnsy(rotation + 180f + angT, backTrns + lenT), - itemSize, itemSize, rotation); - } - } - } - public boolean isBoss(){ return hasEffect(StatusEffects.boss); } diff --git a/core/src/io/anuke/mindustry/entities/type/FlyingUnit.java b/core/src/io/anuke/mindustry/entities/type/FlyingUnit.java index 6620f20c60..83f9434810 100644 --- a/core/src/io/anuke/mindustry/entities/type/FlyingUnit.java +++ b/core/src/io/anuke/mindustry/entities/type/FlyingUnit.java @@ -115,7 +115,6 @@ public abstract class FlyingUnit extends BaseUnit{ Draw.rect(type.region, x, y, rotation - 90); drawWeapons(); - drawItems(); Draw.mixcol(); } diff --git a/core/src/io/anuke/mindustry/entities/type/GroundUnit.java b/core/src/io/anuke/mindustry/entities/type/GroundUnit.java index e319063e9d..47d0e11280 100644 --- a/core/src/io/anuke/mindustry/entities/type/GroundUnit.java +++ b/core/src/io/anuke/mindustry/entities/type/GroundUnit.java @@ -145,8 +145,6 @@ public abstract class GroundUnit extends BaseUnit{ y + Angles.trnsy(tra, getWeapon().width * i, trY), w, type.weapon.region.getHeight() * Draw.scl, rotation - 90); } - drawItems(); - Draw.mixcol(); } diff --git a/core/src/io/anuke/mindustry/entities/type/Player.java b/core/src/io/anuke/mindustry/entities/type/Player.java index 36e48edc20..afd3b08734 100644 --- a/core/src/io/anuke/mindustry/entities/type/Player.java +++ b/core/src/io/anuke/mindustry/entities/type/Player.java @@ -65,7 +65,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{ public String lastText; public float textFadeTime; - private float walktime; + private float walktime, itemtime; private Queue placeQueue = new Queue<>(); private Tile mining; private Vector2 movement = new Vector2(); @@ -338,25 +338,6 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{ rotation - 90); } - float backTrns = 5f; - if(item.amount > 0){ - ItemStack stack = item; - int stored = Mathf.clamp(stack.amount / 6, 1, 8); - - for(int i = 0; i < stored; i++){ - float angT = i == 0 ? 0 : Mathf.randomSeedRange(i + 1, 60f); - float lenT = i == 0 ? 0 : Mathf.randomSeedRange(i + 2, 1f) - 1f; - Draw.rect(stack.item.icon(Item.Icon.large), - x + Angles.trnsx(rotation + 180f + angT, backTrns + lenT), - y + Angles.trnsy(rotation + 180f + angT, backTrns + lenT), - itemSize, itemSize, rotation); - } - - Lines.stroke(1f, Pal.accent); - Lines.circle(x + Angles.trnsx(rotation + 180f, backTrns), - y + Angles.trnsy(rotation + 180f, backTrns), 3f + Mathf.absin(Time.time(), 4f, 1f)); - } - Draw.reset(); } @@ -364,7 +345,8 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{ public void drawStats(){ Draw.color(Color.BLACK, team.color, healthf() + Mathf.absin(Time.time(), healthf() * 5f, 1f - healthf())); Draw.rect(getPowerCellRegion(), x + Angles.trnsx(rotation, mech.cellTrnsY, 0f), y + Angles.trnsy(rotation, mech.cellTrnsY, 0f), rotation - 90); - Draw.color(); + Draw.reset(); + drawBackItems(itemtime, isLocal); } @Override @@ -501,6 +483,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{ public void update(){ hitTime -= Time.delta(); textFadeTime -= Time.delta() / (60 * 5); + itemtime = Mathf.lerpDelta(itemtime, Mathf.num(item.amount > 0), 0.1f); if(Float.isNaN(x) || Float.isNaN(y)){ velocity.set(0f, 0f); diff --git a/core/src/io/anuke/mindustry/entities/type/Unit.java b/core/src/io/anuke/mindustry/entities/type/Unit.java index 833d908782..0b05836ec8 100644 --- a/core/src/io/anuke/mindustry/entities/type/Unit.java +++ b/core/src/io/anuke/mindustry/entities/type/Unit.java @@ -1,33 +1,28 @@ package io.anuke.mindustry.entities.type; -import io.anuke.annotations.Annotations.Nullable; -import io.anuke.arc.Core; -import io.anuke.arc.Events; -import io.anuke.arc.graphics.Color; -import io.anuke.arc.graphics.g2d.Draw; -import io.anuke.arc.graphics.g2d.TextureRegion; -import io.anuke.arc.math.Mathf; -import io.anuke.arc.math.geom.Geometry; -import io.anuke.arc.math.geom.Vector2; +import io.anuke.annotations.Annotations.*; +import io.anuke.arc.*; +import io.anuke.arc.graphics.*; +import io.anuke.arc.graphics.g2d.*; +import io.anuke.arc.math.*; +import io.anuke.arc.math.geom.*; import io.anuke.arc.util.*; -import io.anuke.mindustry.content.Blocks; -import io.anuke.mindustry.content.Fx; +import io.anuke.mindustry.content.*; import io.anuke.mindustry.entities.*; -import io.anuke.mindustry.entities.effect.ScorchDecal; -import io.anuke.mindustry.entities.impl.DestructibleEntity; +import io.anuke.mindustry.entities.effect.*; +import io.anuke.mindustry.entities.impl.*; import io.anuke.mindustry.entities.traits.*; -import io.anuke.mindustry.entities.units.Statuses; -import io.anuke.mindustry.game.EventType.UnitDestroyEvent; -import io.anuke.mindustry.game.Team; -import io.anuke.mindustry.game.Teams.TeamData; +import io.anuke.mindustry.entities.units.*; +import io.anuke.mindustry.game.EventType.*; +import io.anuke.mindustry.game.*; +import io.anuke.mindustry.game.Teams.*; import io.anuke.mindustry.gen.*; -import io.anuke.mindustry.graphics.Pal; -import io.anuke.mindustry.net.Interpolator; +import io.anuke.mindustry.graphics.*; import io.anuke.mindustry.net.Net; +import io.anuke.mindustry.net.*; import io.anuke.mindustry.type.*; -import io.anuke.mindustry.world.Pos; -import io.anuke.mindustry.world.Tile; -import io.anuke.mindustry.world.blocks.Floor; +import io.anuke.mindustry.world.*; +import io.anuke.mindustry.world.blocks.*; import java.io.*; @@ -379,6 +374,40 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ Draw.color(Color.BLACK, team.color, healthf() + Mathf.absin(Time.time(), Math.max(healthf() * 5f, 1f), 1f - healthf())); Draw.rect(getPowerCellRegion(), x, y, rotation - 90); Draw.color(); + + drawBackItems(item.amount > 0 ? 1f : 0f, false); + } + + public void drawBackItems(float itemtime, boolean number){ + //draw back items + if(itemtime > 0.01f && item.item != null){ + float backTrns = 5f; + float size = (itemSize + Mathf.absin(Time.time(), 5f, 1f)) * itemtime; + + Draw.mixcol(Pal.accent, Mathf.absin(Time.time(), 5f, 0.5f)); + Draw.rect(item.item.icon(Item.Icon.large), + x + Angles.trnsx(rotation + 180f, backTrns), + y + Angles.trnsy(rotation + 180f, backTrns), + size, size, rotation); + + Draw.mixcol(); + + Lines.stroke(1f, Pal.accent); + Lines.circle( + x + Angles.trnsx(rotation + 180f, backTrns), + y + Angles.trnsy(rotation + 180f, backTrns), + (3f + Mathf.absin(Time.time(), 5f, 1f)) * itemtime); + + if(number){ + Core.scene.skin.getFont("outlined-font").draw(item.amount + "", + x + Angles.trnsx(rotation + 180f, backTrns), + y + Angles.trnsy(rotation + 180f, backTrns) - 3, + Pal.accent, 0.25f * itemtime, false, Align.center + ); + } + } + + Draw.reset(); } public TextureRegion getPowerCellRegion(){