Bugfixes & unit status polish

This commit is contained in:
Anuken 2020-09-13 22:30:05 -04:00
parent 0e78751c6c
commit bbb9b3ef62
5 changed files with 24 additions and 15 deletions

View File

@ -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());

View File

@ -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();
});
}

View File

@ -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);

View File

@ -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);
}
}

View File

@ -1,3 +1,3 @@
org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=f47e6ce55af4da9be1dd4061aa80bf9c681735fa
archash=c0b689b12364f4abf75c42fc2a3a6ac6043e0aea