Bugfixes & unit status polish
This commit is contained in:
@@ -109,7 +109,7 @@ public class EditorTile extends Tile{
|
|||||||
|
|
||||||
if(block.hasEntity()){
|
if(block.hasEntity()){
|
||||||
build = entityprov.get().init(this, team, false, rotation);
|
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.hasItems) build.items = new ItemModule();
|
||||||
if(block.hasLiquids) build.liquids(new LiquidModule());
|
if(block.hasLiquids) build.liquids(new LiquidModule());
|
||||||
if(block.hasPower) build.power(new PowerModule());
|
if(block.hasPower) build.power(new PowerModule());
|
||||||
|
|||||||
@@ -254,14 +254,9 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
"height", editor.height()
|
"height", editor.height()
|
||||||
));
|
));
|
||||||
world.endMapLoad();
|
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.set(world.width() * tilesize/2f, world.height() * tilesize/2f);
|
||||||
player.clearUnit();
|
player.clearUnit();
|
||||||
|
Groups.unit.clear();
|
||||||
logic.play();
|
logic.play();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -638,28 +638,42 @@ public class HudFragment extends Fragment{
|
|||||||
|
|
||||||
table.marginTop(0).marginBottom(4).marginLeft(4);
|
table.marginTop(0).marginBottom(4).marginLeft(4);
|
||||||
|
|
||||||
class Bar extends Element{
|
class SideBar extends Element{
|
||||||
public final Floatp amount;
|
public final Floatp amount;
|
||||||
public final boolean flip;
|
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.amount = amount;
|
||||||
this.flip = flip;
|
this.flip = flip;
|
||||||
|
this.flash = flash;
|
||||||
|
|
||||||
setColor(Pal.health);
|
setColor(Pal.health);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
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);
|
drawInner(Pal.darkishGray);
|
||||||
|
|
||||||
Draw.beginStencil();
|
Draw.beginStencil();
|
||||||
|
|
||||||
Fill.crect(x, y, width, height * amount.get());
|
Fill.crect(x, y, width, height * value);
|
||||||
|
|
||||||
Draw.beginStenciled();
|
Draw.beginStenciled();
|
||||||
|
|
||||||
drawInner(color);
|
drawInner(Tmp.c1.set(color).lerp(Color.white, blink));
|
||||||
|
|
||||||
Draw.endStencil();
|
Draw.endStencil();
|
||||||
}
|
}
|
||||||
@@ -712,9 +726,9 @@ public class HudFragment extends Fragment{
|
|||||||
float pad = -30;
|
float pad = -30;
|
||||||
t.margin(0);
|
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.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);
|
b.color.set(player.displayAmmo() ? Pal.ammo : Pal.health);
|
||||||
});
|
});
|
||||||
})).size(120f, 80).padRight(4);
|
})).size(120f, 80).padRight(4);
|
||||||
|
|||||||
@@ -509,7 +509,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(block.hasEntity()){
|
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.daemon=true
|
||||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||||
archash=f47e6ce55af4da9be1dd4061aa80bf9c681735fa
|
archash=c0b689b12364f4abf75c42fc2a3a6ac6043e0aea
|
||||||
|
|||||||
Reference in New Issue
Block a user