mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-13 12:16:53 +07:00
Bugfixes & unit status polish
This commit is contained in:
parent
0e78751c6c
commit
bbb9b3ef62
@ -109,7 +109,7 @@ public class EditorTile extends Tile{
|
||||
|
||||
if(block.hasEntity()){
|
||||
build = entityprov.get().init(this, team, false, rotation);
|
||||
build.cons(new ConsumeModule(build));
|
||||
build.cons = new ConsumeModule(build);
|
||||
if(block.hasItems) build.items = new ItemModule();
|
||||
if(block.hasLiquids) build.liquids(new LiquidModule());
|
||||
if(block.hasPower) build.power(new PowerModule());
|
||||
|
@ -254,14 +254,9 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
"height", editor.height()
|
||||
));
|
||||
world.endMapLoad();
|
||||
//add entities so they update. is this really needed?
|
||||
for(Tile tile : world.tiles){
|
||||
if(tile.build != null){
|
||||
tile.build.add();
|
||||
}
|
||||
}
|
||||
player.set(world.width() * tilesize/2f, world.height() * tilesize/2f);
|
||||
player.clearUnit();
|
||||
Groups.unit.clear();
|
||||
logic.play();
|
||||
});
|
||||
}
|
||||
|
@ -638,28 +638,42 @@ public class HudFragment extends Fragment{
|
||||
|
||||
table.marginTop(0).marginBottom(4).marginLeft(4);
|
||||
|
||||
class Bar extends Element{
|
||||
class SideBar extends Element{
|
||||
public final Floatp amount;
|
||||
public final boolean flip;
|
||||
public final Boolp flash;
|
||||
|
||||
public Bar(Floatp amount, boolean flip){
|
||||
float last, blink, value;
|
||||
|
||||
public SideBar(Floatp amount, Boolp flash, boolean flip){
|
||||
this.amount = amount;
|
||||
this.flip = flip;
|
||||
this.flash = flash;
|
||||
|
||||
setColor(Pal.health);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
float next = amount.get();
|
||||
|
||||
if(next < last && flash.get()){
|
||||
blink = 1f;
|
||||
}
|
||||
|
||||
blink = Mathf.lerpDelta(blink, 0f, 0.2f);
|
||||
value = Mathf.lerpDelta(value, next, 0.15f);
|
||||
last = next;
|
||||
|
||||
drawInner(Pal.darkishGray);
|
||||
|
||||
Draw.beginStencil();
|
||||
|
||||
Fill.crect(x, y, width, height * amount.get());
|
||||
Fill.crect(x, y, width, height * value);
|
||||
|
||||
Draw.beginStenciled();
|
||||
|
||||
drawInner(color);
|
||||
drawInner(Tmp.c1.set(color).lerp(Color.white, blink));
|
||||
|
||||
Draw.endStencil();
|
||||
}
|
||||
@ -712,9 +726,9 @@ public class HudFragment extends Fragment{
|
||||
float pad = -30;
|
||||
t.margin(0);
|
||||
|
||||
t.add(new Bar(() -> player.unit().healthf(), true)).width(bw).growY().padRight(pad);
|
||||
t.add(new SideBar(() -> player.unit().healthf(), () -> true, true)).width(bw).growY().padRight(pad);
|
||||
t.image(() -> player.icon()).scaling(Scaling.bounded).grow();
|
||||
t.add(new Bar(() -> player.dead() ? 0f : player.displayAmmo() ? player.unit().ammof() : player.unit().healthf(), false)).width(bw).growY().padLeft(pad).update(b -> {
|
||||
t.add(new SideBar(() -> player.dead() ? 0f : player.displayAmmo() ? player.unit().ammof() : player.unit().healthf(), () -> !player.displayAmmo(), false)).width(bw).growY().padLeft(pad).update(b -> {
|
||||
b.color.set(player.displayAmmo() ? Pal.ammo : Pal.health);
|
||||
});
|
||||
})).size(120f, 80).padRight(4);
|
||||
|
@ -509,7 +509,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
||||
}
|
||||
|
||||
if(block.hasEntity()){
|
||||
build = entityprov.get().init(this, team, block.update, rotation);
|
||||
build = entityprov.get().init(this, team, block.update && !state.isEditor(), rotation);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||
archash=f47e6ce55af4da9be1dd4061aa80bf9c681735fa
|
||||
archash=c0b689b12364f4abf75c42fc2a3a6ac6043e0aea
|
||||
|
Loading…
Reference in New Issue
Block a user