Added unit drops, boosting

This commit is contained in:
Anuken
2018-06-21 15:58:37 -04:00
parent a76e99af86
commit f7dbe807e4
17 changed files with 263 additions and 196 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 B

After

Width:  |  Height:  |  Size: 269 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View File

@@ -40,7 +40,7 @@ public class Vars{
//waves can last no longer than 3 minutes, otherwise the next one spawns //waves can last no longer than 3 minutes, otherwise the next one spawns
public static final float maxwavespace = 60*60*4f; public static final float maxwavespace = 60*60*4f;
public static final float coreBuildRange = 400f; public static final float coreBuildRange = 800f;
//discord group URL //discord group URL
public static final String discordURL = "https://discord.gg/BKADYds"; public static final String discordURL = "https://discord.gg/BKADYds";

View File

@@ -15,32 +15,32 @@ public class AmmoTypes implements ContentList {
//bullets //bullets
bulletIron = new AmmoType(Items.iron, StandardBullets.iron, 5) {{ bulletIron = new AmmoType(Items.iron, StandardBullets.iron, 3) {{
shootEffect = ShootFx.shootSmall; shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke; smokeEffect = ShootFx.shootSmallSmoke;
}}; }};
bulletLead = new AmmoType(Items.lead, StandardBullets.lead, 5) {{ bulletLead = new AmmoType(Items.lead, StandardBullets.lead, 3) {{
shootEffect = ShootFx.shootSmall; shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke; smokeEffect = ShootFx.shootSmallSmoke;
}}; }};
bulletSteel = new AmmoType(Items.steel, StandardBullets.steel, 5) {{ bulletSteel = new AmmoType(Items.steel, StandardBullets.steel, 3) {{
shootEffect = ShootFx.shootSmall; shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke; smokeEffect = ShootFx.shootSmallSmoke;
}}; }};
bulletThorium = new AmmoType(Items.thorium, StandardBullets.thorium, 5) {{ bulletThorium = new AmmoType(Items.thorium, StandardBullets.thorium, 3) {{
shootEffect = ShootFx.shootSmall; shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke; smokeEffect = ShootFx.shootSmallSmoke;
}}; }};
bulletSilicon = new AmmoType(Items.silicon, StandardBullets.homing, 5) {{ bulletSilicon = new AmmoType(Items.silicon, StandardBullets.homing, 3) {{
shootEffect = ShootFx.shootSmall; shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke; smokeEffect = ShootFx.shootSmallSmoke;
}}; }};
bulletThermite = new AmmoType(Items.thermite, StandardBullets.tracer, 5) {{ bulletThermite = new AmmoType(Items.thermite, StandardBullets.tracer, 3) {{
shootEffect = ShootFx.shootSmall; shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke; smokeEffect = ShootFx.shootSmallSmoke;
}}; }};

View File

@@ -17,26 +17,22 @@ public class Mechs implements ContentList {
alpha = new Mech("alpha-mech", false){{ alpha = new Mech("alpha-mech", false){{
drillPower = 2; drillPower = 2;
speed = 1.1f; speed = 0.5f;
maxSpeed = 1.1f;
}}; }};
delta = new Mech("delta-mech", false){{ delta = new Mech("delta-mech", false){{
drillPower = -1; drillPower = -1;
speed = 1.5f; speed = 0.6f;
maxSpeed = 1.5f;
}}; }};
tau = new Mech("tau-mech", false){{ tau = new Mech("tau-mech", false){{
drillPower = 2; drillPower = 2;
speed = 1.1f; speed = 0.5f;
maxSpeed = 1.1f;
}}; }};
omega = new Mech("omega-mech", false){{ omega = new Mech("omega-mech", false){{
drillPower = 1; drillPower = 1;
speed = 1.0f; speed = 0.4f;
maxSpeed = 1.0f;
}}; }};
dart = new Mech("dart-ship", true){{ dart = new Mech("dart-ship", true){{

View File

@@ -40,6 +40,7 @@ public class Recipes implements ContentList{
new Recipe(power, PowerBlocks.battery, new ItemStack(Items.iron, 8), new ItemStack(Items.lead, 30)); new Recipe(power, PowerBlocks.battery, new ItemStack(Items.iron, 8), new ItemStack(Items.lead, 30));
//new Recipe(power, PowerBlocks.batteryLarge, new ItemStack(Items.steel, 5), new ItemStack(Items.iron, 5)); //new Recipe(power, PowerBlocks.batteryLarge, new ItemStack(Items.steel, 5), new ItemStack(Items.iron, 5));
new Recipe(power, PowerBlocks.combustiongenerator, new ItemStack(Items.iron, 30), new ItemStack(Items.lead, 30)); new Recipe(power, PowerBlocks.combustiongenerator, new ItemStack(Items.iron, 30), new ItemStack(Items.lead, 30));
//new Recipe(distribution, StorageBlocks.vault, new ItemStack(Items.steel, 50)); //new Recipe(distribution, StorageBlocks.vault, new ItemStack(Items.steel, 50));
//new Recipe(distribution, StorageBlocks.core, new ItemStack(Items.steel, 50)); //new Recipe(distribution, StorageBlocks.core, new ItemStack(Items.steel, 50));
//new Recipe(distribution, StorageBlocks.unloader, new ItemStack(Items.steel, 5)); //new Recipe(distribution, StorageBlocks.unloader, new ItemStack(Items.steel, 5));
@@ -49,6 +50,10 @@ public class Recipes implements ContentList{
new Recipe(production, ProductionBlocks.reinforcedDrill, new ItemStack(Items.iron, 20), new ItemStack(Items.lead, 20)); new Recipe(production, ProductionBlocks.reinforcedDrill, new ItemStack(Items.iron, 20), new ItemStack(Items.lead, 20));
new Recipe(production, ProductionBlocks.steelDrill, new ItemStack(Items.iron, 40), new ItemStack(Items.lead, 25), new ItemStack(Items.steel, 25)); new Recipe(production, ProductionBlocks.steelDrill, new ItemStack(Items.iron, 40), new ItemStack(Items.lead, 25), new ItemStack(Items.steel, 25));
new Recipe(production, ProductionBlocks.titaniumDrill, new ItemStack(Items.iron, 40), new ItemStack(Items.titanium, 40), new ItemStack(Items.steel, 40)); new Recipe(production, ProductionBlocks.titaniumDrill, new ItemStack(Items.iron, 40), new ItemStack(Items.titanium, 40), new ItemStack(Items.steel, 40));
new Recipe(units, UnitBlocks.droneFactory, new ItemStack(Items.iron, 50), new ItemStack(Items.lead, 50));
new Recipe(units, UnitBlocks.repairPoint, new ItemStack(Items.lead, 20), new ItemStack(Items.steel, 10));
/* /*
new Recipe(production, ProductionBlocks.laserdrill, new ItemStack(Items.titanium, 40), new ItemStack(Items.surgealloy, 40)); new Recipe(production, ProductionBlocks.laserdrill, new ItemStack(Items.titanium, 40), new ItemStack(Items.surgealloy, 40));
new Recipe(production, ProductionBlocks.nucleardrill, new ItemStack(Items.titanium, 40), new ItemStack(Items.surgealloy, 40)); new Recipe(production, ProductionBlocks.nucleardrill, new ItemStack(Items.titanium, 40), new ItemStack(Items.surgealloy, 40));

View File

@@ -21,7 +21,8 @@ public class DefenseBlocks extends BlockList implements ContentList {
}}; }};
ironwalllarge = new Wall("ironwall-large") {{ ironwalllarge = new Wall("ironwall-large") {{
health = 80 * wallHealthMultiplier; health = 80 * 4 * wallHealthMultiplier;
size = 2;
}}; }};
steelwall = new Wall("steelwall") {{ steelwall = new Wall("steelwall") {{

View File

@@ -170,8 +170,10 @@ public class NetServer extends Module{
long elapsed = TimeUtils.timeSinceMillis(connection.lastRecievedTime); long elapsed = TimeUtils.timeSinceMillis(connection.lastRecievedTime);
float maxSpeed = packet.boosting ? player.mech.boostSpeed : player.mech.speed;
//extra 1.1x multiplicaton is added just in case //extra 1.1x multiplicaton is added just in case
float maxMove = elapsed / 1000f * 60f * player.mech.maxSpeed * 1.1f; float maxMove = elapsed / 1000f * 60f * maxSpeed * 1.1f;
player.pointerX = packet.pointerX; player.pointerX = packet.pointerX;
player.pointerY = packet.pointerY; player.pointerY = packet.pointerY;

View File

@@ -32,7 +32,10 @@ import io.anuke.ucore.entities.EntityGroup;
import io.anuke.ucore.entities.trait.SolidTrait; import io.anuke.ucore.entities.trait.SolidTrait;
import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Lines; import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.*; import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.ThreadQueue;
import io.anuke.ucore.util.Timer;
import java.io.DataInput; import java.io.DataInput;
import java.io.DataOutput; import java.io.DataOutput;
@@ -54,7 +57,8 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
public float pointerX, pointerY; public float pointerX, pointerY;
public String name = "name"; public String name = "name";
public String uuid, usid; public String uuid, usid;
public boolean isAdmin, isTransferring, isShooting; public boolean isAdmin, isTransferring, isShooting, isBoosting;
public float boostHeat;
public Color color = new Color(); public Color color = new Color();
public Mech mech; public Mech mech;
@@ -83,7 +87,6 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
//region unit and event overrides, utility methods //region unit and event overrides, utility methods
@Override @Override
public int getItemCapacity() { public int getItemCapacity() {
return mech.itemCapacity; return mech.itemCapacity;
@@ -250,10 +253,12 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
if((debug && (!showPlayer || !showUI)) || dead) return; if((debug && (!showPlayer || !showUI)) || dead) return;
if(!movement.isZero() && moved){ if(!movement.isZero() && moved){
walktime += Timers.delta() * movement.len()/1.6f * getFloorOn().speedMultiplier; walktime += Timers.delta() * movement.len()/0.7f * getFloorOn().speedMultiplier;
baseRotation = Mathf.slerpDelta(baseRotation, movement.angle(), 0.13f); baseRotation = Mathf.slerpDelta(baseRotation, movement.angle(), 0.13f);
} }
boostHeat = Mathf.lerpDelta(boostHeat, isBoosting ? 1f : 0f, 0.08f);
boolean snap = snapCamera && isLocal; boolean snap = snapCamera && isLocal;
float px = x, py =y; float px = x, py =y;
@@ -263,7 +268,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
y = (int)y; y = (int)y;
} }
float ft = Mathf.sin(walktime, 6f, 2f); float ft = Mathf.sin(walktime, 6f, 2f) * (1f-boostHeat);
Floor floor = getFloorOn(); Floor floor = getFloorOn();
@@ -275,11 +280,15 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
Draw.tint(Color.WHITE, floor.liquidColor, 0.5f); Draw.tint(Color.WHITE, floor.liquidColor, 0.5f);
} }
float boostTrnsY = -boostHeat * 3f;
float boostTrnsX = boostHeat * 3f;
float boostAng = boostHeat*40f;
for (int i : Mathf.signs) { for (int i : Mathf.signs) {
Draw.rect(mech.legRegion, Draw.rect(mech.legRegion,
x + Angles.trnsx(baseRotation, ft * i), x + Angles.trnsx(baseRotation, ft * i + boostTrnsY, -boostTrnsX*i),
y + Angles.trnsy(baseRotation, ft * i), y + Angles.trnsy(baseRotation, ft * i + boostTrnsY, -boostTrnsX*i),
12f * i, 12f - Mathf.clamp(ft * i, 0, 2), baseRotation - 90); 12f * i, 12f - Mathf.clamp(ft * i, 0, 2), baseRotation - 90 + boostAng*i);
} }
Draw.rect(mech.baseRegion, x, y, baseRotation- 90); Draw.rect(mech.baseRegion, x, y, baseRotation- 90);
@@ -328,8 +337,13 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
drawBuilding(this); drawBuilding(this);
} }
if(mech.flying){ if(mech.flying || boostHeat > 0.001f){
trail.draw(Palette.lighterOrange, Palette.lightishOrange, 5f); float wobblyness = 0.6f;
trail.update(x + Angles.trnsx(rotation + 180f, 5f) + Mathf.range(wobblyness),
y + Angles.trnsy(rotation + 180f, 5f) + Mathf.range(wobblyness));
trail.draw(Palette.lighterOrange, Palette.lightishOrange, 5f * (isFlying() ? 1f : boostHeat));
}else{
trail.clear();
} }
} }
@@ -421,11 +435,6 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
avoidOthers(8f); avoidOthers(8f);
float wobblyness = 0.6f;
trail.update(x + Angles.trnsx(rotation + 180f, 6f) + Mathf.range(wobblyness),
y + Angles.trnsy(rotation + 180f, 6f) + Mathf.range(wobblyness));
if(!isShooting()) { if(!isShooting()) {
updateBuilding(this); updateBuilding(this);
} }
@@ -444,7 +453,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
if(ui.chatfrag.chatOpen()) return; if(ui.chatfrag.chatOpen()) return;
float speed = Inputs.keyDown("dash") && debug ? 5f : mech.speed; float speed = isBoosting ? mech.boostSpeed : mech.speed;
float carrySlowdown = 0.3f; float carrySlowdown = 0.3f;
speed *= ((1f-carrySlowdown) + (inventory.hasItem() ? (float)inventory.getItem().amount/inventory.capacity(): 1f) * carrySlowdown); speed *= ((1f-carrySlowdown) + (inventory.hasItem() ? (float)inventory.getItem().amount/inventory.capacity(): 1f) * carrySlowdown);
@@ -474,14 +483,12 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
} }
} }
movement.set(0, 0); movement.setZero();
String section = "player_" + (playerIndex + 1); String section = "player_" + (playerIndex + 1);
float xa = Inputs.getAxis(section, "move_x"); float xa = Inputs.getAxis(section, "move_x");
float ya = Inputs.getAxis(section, "move_y"); float ya = Inputs.getAxis(section, "move_y");
if(Math.abs(xa) < 0.3) xa = 0;
if(Math.abs(ya) < 0.3) ya = 0;
movement.y += ya*speed; movement.y += ya*speed;
movement.x += xa*speed; movement.x += xa*speed;
@@ -497,7 +504,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
velocity.add(movement); velocity.add(movement);
float prex = x, prey = y; float prex = x, prey = y;
updateVelocityStatus(mech.drag, debug ? speed : mech.maxSpeed); updateVelocityStatus(mech.drag, 10f);
moved = distanceTo(prex, prey) > 0.01f; moved = distanceTo(prex, prey) > 0.01f;
if(!isShooting()){ if(!isShooting()){
@@ -620,7 +627,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
} }
public boolean isShooting(){ public boolean isShooting(){
return isShooting && inventory.hasAmmo(); return isShooting && inventory.hasAmmo() && !isBoosting;
} }
public void setRespawning(){ public void setRespawning(){
@@ -680,6 +687,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
buffer.writeInt(Color.rgba8888(color)); buffer.writeInt(Color.rgba8888(color));
buffer.writeBoolean(dead); buffer.writeBoolean(dead);
buffer.writeByte(mech.id); buffer.writeByte(mech.id);
buffer.writeBoolean(isBoosting);
} }
@Override @Override
@@ -691,12 +699,15 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
color.set(buffer.readInt()); color.set(buffer.readInt());
dead = buffer.readBoolean(); dead = buffer.readBoolean();
mech = Upgrade.getByID(buffer.readByte()); mech = Upgrade.getByID(buffer.readByte());
boolean dashing = buffer.readBoolean();
interpolator.read(lastx, lasty, x, y, time, rotation); interpolator.read(lastx, lasty, x, y, time, rotation);
rotation = lastrot; rotation = lastrot;
if(isLocal){ if(isLocal){
x = lastx; x = lastx;
y = lasty; y = lasty;
}else{
isBoosting = dashing;
} }
} }

View File

@@ -306,6 +306,7 @@ public abstract class BaseUnit extends Unit{
if(unit == null) return; if(unit == null) return;
unit.onSuperDeath(); unit.onSuperDeath();
UnitDrops.dropItems(unit);
Effects.effect(ExplosionFx.explosion, unit); Effects.effect(ExplosionFx.explosion, unit);
Effects.shake(2f, 2f, unit); Effects.shake(2f, 2f, unit);

View File

@@ -0,0 +1,24 @@
package io.anuke.mindustry.entities.units;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.gen.CallEntity;
import io.anuke.mindustry.type.Item;
import io.anuke.ucore.util.Mathf;
public class UnitDrops {
private static Item[] dropTable;
public static void dropItems(BaseUnit unit){
if(dropTable == null){
dropTable = new Item[]{Items.iron, Items.lead, Items.steel};
}
for(Item item : dropTable){
if(Mathf.chance(0.2)){
int amount = Mathf.random(1, 30);
CallEntity.createItemDrop(item, amount, unit.x + Mathf.range(2f), unit.y + Mathf.range(2f),
unit.getVelocity().x + Mathf.range(0.5f), unit.getVelocity().y + Mathf.range(0.5f));
}
}
}
}

View File

@@ -126,6 +126,8 @@ public class DesktopInput extends InputHandler{
public void update(){ public void update(){
if(player.isDead() || state.is(State.menu) || ui.hasDialog()) return; if(player.isDead() || state.is(State.menu) || ui.hasDialog()) return;
player.isBoosting = Inputs.keyDown("dash");
//deslect if not placing //deslect if not placing
if(!isPlacing() && mode == placing){ if(!isPlacing() && mode == placing){
mode = none; mode = none;

View File

@@ -104,6 +104,7 @@ public class Packets {
public long timeSent; public long timeSent;
//player snapshot data //player snapshot data
public float x, y, pointerX, pointerY, rotation, baseRotation, xv, yv; public float x, y, pointerX, pointerY, rotation, baseRotation, xv, yv;
public boolean boosting;
@Override @Override
public void write(ByteBuffer buffer) { public void write(ByteBuffer buffer) {
@@ -117,6 +118,7 @@ public class Packets {
buffer.putFloat(player.y); buffer.putFloat(player.y);
buffer.putFloat(player.pointerX); buffer.putFloat(player.pointerX);
buffer.putFloat(player.pointerY); buffer.putFloat(player.pointerY);
buffer.put(player.isBoosting ? (byte)1 : 0);
buffer.put((byte)(Mathf.clamp(player.getVelocity().x, -Unit.maxAbsVelocity, Unit.maxAbsVelocity) * Unit.velocityPercision)); buffer.put((byte)(Mathf.clamp(player.getVelocity().x, -Unit.maxAbsVelocity, Unit.maxAbsVelocity) * Unit.velocityPercision));
buffer.put((byte)(Mathf.clamp(player.getVelocity().y, -Unit.maxAbsVelocity, Unit.maxAbsVelocity) * Unit.velocityPercision)); buffer.put((byte)(Mathf.clamp(player.getVelocity().y, -Unit.maxAbsVelocity, Unit.maxAbsVelocity) * Unit.velocityPercision));
@@ -135,6 +137,7 @@ public class Packets {
y = buffer.getFloat(); y = buffer.getFloat();
pointerX = buffer.getFloat(); pointerX = buffer.getFloat();
pointerY = buffer.getFloat(); pointerY = buffer.getFloat();
boosting = buffer.get() == 1;
xv = buffer.get() / Unit.velocityPercision; xv = buffer.get() / Unit.velocityPercision;
yv = buffer.get() / Unit.velocityPercision; yv = buffer.get() / Unit.velocityPercision;
rotation = buffer.getShort()/2f; rotation = buffer.getShort()/2f;

View File

@@ -9,6 +9,7 @@ public class Mech extends Upgrade {
public float speed = 1.1f; public float speed = 1.1f;
public float maxSpeed = 1.1f; public float maxSpeed = 1.1f;
public float boostSpeed = 0.75f;
public float drag = 0.4f; public float drag = 0.4f;
public float mass = 1f; public float mass = 1f;
public float armor = 1f; public float armor = 1f;

View File

@@ -1,10 +1,12 @@
package io.anuke.mindustry.ui.fragments; package io.anuke.mindustry.ui.fragments;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Interpolation; import com.badlogic.gdx.math.Interpolation;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.input.InputHandler; import io.anuke.mindustry.input.InputHandler;
import io.anuke.mindustry.type.Category; import io.anuke.mindustry.type.Category;
import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.type.ItemStack;
@@ -116,6 +118,7 @@ public class BlocksFragment implements Fragment{
int cati = 0; int cati = 0;
int checkedi = 0; int checkedi = 0;
int rowsUsed = 0;
//add categories //add categories
for (Category cat : Category.values()) { for (Category cat : Category.values()) {
@@ -184,6 +187,8 @@ public class BlocksFragment implements Fragment{
} }
image.getImageCell().setActor(istack).size(size); image.getImageCell().setActor(istack).size(size);
image.getStyle().imageUpColor = Color.WHITE;
image.getStyle().imageDisabledColor = Color.GRAY;
image.addChild(istack); image.addChild(istack);
image.setTouchable(Touchable.enabled); image.setTouchable(Touchable.enabled);
image.getImage().remove(); image.getImage().remove();
@@ -225,9 +230,23 @@ public class BlocksFragment implements Fragment{
} }
}); });
image.setDisabled(() -> {
TileEntity entity = players[0].getClosestCore();
if(entity == null) return true;
for(ItemStack s : r.requirements){
if(!entity.items.hasItem(s.item, Mathf.ceil(s.amount/2f))){
return true;
}
}
return false;
});
recipeTable.add(image).size(size + 8); recipeTable.add(image).size(size + 8);
image.update(() -> { image.update(() -> {
image.getImage().setColor(image.isDisabled() ? Color.GRAY : Color.WHITE);
for(Player player : players){ for(Player player : players){
if(control.input(player.playerIndex).recipe == r){ if(control.input(player.playerIndex).recipe == r){
image.setChecked(true); image.setChecked(true);
@@ -238,6 +257,7 @@ public class BlocksFragment implements Fragment{
}); });
if (i % rows == rows - 1) { if (i % rows == rows - 1) {
rowsUsed = Math.max((i+1)/rows, rowsUsed);
recipeTable.row(); recipeTable.row();
} }
@@ -252,7 +272,7 @@ public class BlocksFragment implements Fragment{
} }
selectTable.row(); selectTable.row();
selectTable.add(stack).growX().left().top().colspan(Category.values().length).padBottom(-5).height((size + 12)*maxrow); selectTable.add(stack).growX().left().top().colspan(Category.values().length).padBottom(-5).height((size + 12)*rowsUsed);
} }
void toggle(boolean show, float t, Interpolation ip){ void toggle(boolean show, float t, Interpolation ip){
@@ -305,14 +325,7 @@ public class BlocksFragment implements Fragment{
for(ItemStack stack : recipe.requirements){ for(ItemStack stack : recipe.requirements){
requirements.addImage(stack.item.region).size(8*3); requirements.addImage(stack.item.region).size(8*3);
Label reqlabel = new Label(""); Label reqlabel = new Label(() -> Mathf.clamp(stack.amount, 0, stack.amount) + "/" + stack.amount);
reqlabel.update(() -> {
int current = stack.amount;
String text = Mathf.clamp(current, 0, stack.amount) + "/" + stack.amount;
reqlabel.setText(text);
});
requirements.add(reqlabel).left(); requirements.add(reqlabel).left();
requirements.row(); requirements.row();

View File

@@ -36,7 +36,8 @@ public class ColorMapper{
"c3a490", pair(Blocks.iron), "c3a490", pair(Blocks.iron),
"161616", pair(Blocks.coal), "161616", pair(Blocks.coal),
"6277bc", pair(Blocks.titanium), "6277bc", pair(Blocks.titanium),
"83bc58", pair(Blocks.thorium), "c594dc", pair(Blocks.thorium),
"9790b5", pair(Blocks.lead),
"000000", pair(Blocks.space) "000000", pair(Blocks.space)
); );
} }