Fixed no-wave FPS display / Fixed unit pad inventories
This commit is contained in:
@@ -14,7 +14,7 @@ public class UnitBlocks extends BlockList implements ContentList{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(){
|
public void load(){
|
||||||
dronePad = new UnitFactory("drone-pad"){{
|
dronePad = new UnitPad("drone-pad"){{
|
||||||
type = UnitTypes.drone;
|
type = UnitTypes.drone;
|
||||||
produceTime = 800;
|
produceTime = 800;
|
||||||
size = 2;
|
size = 2;
|
||||||
@@ -22,7 +22,7 @@ public class UnitBlocks extends BlockList implements ContentList{
|
|||||||
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 30), new ItemStack(Items.lead, 30)});
|
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 30), new ItemStack(Items.lead, 30)});
|
||||||
}};
|
}};
|
||||||
|
|
||||||
fabricatorPad = new UnitFactory("fabricator-pad"){{
|
fabricatorPad = new UnitPad("fabricator-pad"){{
|
||||||
type = UnitTypes.fabricator;
|
type = UnitTypes.fabricator;
|
||||||
produceTime = 1600;
|
produceTime = 1600;
|
||||||
size = 2;
|
size = 2;
|
||||||
@@ -30,7 +30,7 @@ public class UnitBlocks extends BlockList implements ContentList{
|
|||||||
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 70), new ItemStack(Items.lead, 80), new ItemStack(Items.titanium, 80)});
|
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 70), new ItemStack(Items.lead, 80), new ItemStack(Items.titanium, 80)});
|
||||||
}};
|
}};
|
||||||
|
|
||||||
interceptorPad = new UnitFactory("interceptor-pad"){{
|
interceptorPad = new UnitPad("interceptor-pad"){{
|
||||||
type = UnitTypes.interceptor;
|
type = UnitTypes.interceptor;
|
||||||
produceTime = 1300;
|
produceTime = 1300;
|
||||||
size = 2;
|
size = 2;
|
||||||
@@ -38,7 +38,7 @@ public class UnitBlocks extends BlockList implements ContentList{
|
|||||||
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 30), new ItemStack(Items.titanium, 40)});
|
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 30), new ItemStack(Items.titanium, 40)});
|
||||||
}};
|
}};
|
||||||
|
|
||||||
monsoonPad = new UnitFactory("monsoon-pad"){{
|
monsoonPad = new UnitPad("monsoon-pad"){{
|
||||||
type = UnitTypes.monsoon;
|
type = UnitTypes.monsoon;
|
||||||
produceTime = 1400;
|
produceTime = 1400;
|
||||||
size = 3;
|
size = 3;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import io.anuke.mindustry.type.ItemStack;
|
|||||||
import io.anuke.mindustry.type.Weapon;
|
import io.anuke.mindustry.type.Weapon;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.blocks.units.CommandCenter.CommandCenterEntity;
|
import io.anuke.mindustry.world.blocks.units.CommandCenter.CommandCenterEntity;
|
||||||
import io.anuke.mindustry.world.blocks.units.UnitFactory.UnitFactoryEntity;
|
import io.anuke.mindustry.world.blocks.units.UnitPad.UnitFactoryEntity;
|
||||||
import io.anuke.mindustry.world.meta.BlockFlag;
|
import io.anuke.mindustry.world.meta.BlockFlag;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public class HudFragment extends Fragment{
|
|||||||
|
|
||||||
cont.row();
|
cont.row();
|
||||||
|
|
||||||
cont.table(this::addWaveTable).touchable(Touchable.enabled).fillX().height(66f);
|
Table waves = cont.table(this::addWaveTable).touchable(Touchable.enabled).fillX().height(66f).get();
|
||||||
|
|
||||||
cont.row();
|
cont.row();
|
||||||
|
|
||||||
@@ -112,7 +112,9 @@ public class HudFragment extends Fragment{
|
|||||||
if(Net.hasClient()){
|
if(Net.hasClient()){
|
||||||
t.label(() -> ping.get(Net.getPing())).visible(() -> Net.client() && !gwt).colspan(2);
|
t.label(() -> ping.get(Net.getPing())).visible(() -> Net.client() && !gwt).colspan(2);
|
||||||
}
|
}
|
||||||
}).size(-1).visible(() -> Settings.getBool("fps")).get();
|
}).size(-1).visible(() -> Settings.getBool("fps")).update(t -> {
|
||||||
|
t.setTranslation(0, state.mode.disableWaves ? waves.getHeight() : 0);
|
||||||
|
}).get();
|
||||||
|
|
||||||
//make wave box appear below rest of menu
|
//make wave box appear below rest of menu
|
||||||
cont.swapActor(wavetable, menu.getParent());
|
cont.swapActor(wavetable, menu.getParent());
|
||||||
|
|||||||
+15
-4
@@ -34,19 +34,20 @@ import java.io.DataInputStream;
|
|||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class UnitFactory extends Block{
|
public class UnitPad extends Block{
|
||||||
protected UnitType type;
|
protected UnitType type;
|
||||||
protected float produceTime = 1000f;
|
protected float produceTime = 1000f;
|
||||||
protected float openDuration = 50f;
|
protected float openDuration = 50f;
|
||||||
protected float launchVelocity = 0f;
|
protected float launchVelocity = 0f;
|
||||||
protected String unitRegion;
|
protected String unitRegion;
|
||||||
|
|
||||||
public UnitFactory(String name){
|
public UnitPad(String name){
|
||||||
super(name);
|
super(name);
|
||||||
update = true;
|
update = true;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
solidifes = true;
|
solidifes = true;
|
||||||
|
itemCapacity = 10;
|
||||||
|
|
||||||
consumes.require(ConsumeItems.class);
|
consumes.require(ConsumeItems.class);
|
||||||
}
|
}
|
||||||
@@ -54,7 +55,7 @@ public class UnitFactory extends Block{
|
|||||||
@Remote(called = Loc.server)
|
@Remote(called = Loc.server)
|
||||||
public static void onUnitFactorySpawn(Tile tile){
|
public static void onUnitFactorySpawn(Tile tile){
|
||||||
UnitFactoryEntity entity = tile.entity();
|
UnitFactoryEntity entity = tile.entity();
|
||||||
UnitFactory factory = (UnitFactory) tile.block();
|
UnitPad factory = (UnitPad) tile.block();
|
||||||
|
|
||||||
entity.buildTime = 0f;
|
entity.buildTime = 0f;
|
||||||
entity.hasSpawned = true;
|
entity.hasSpawned = true;
|
||||||
@@ -188,13 +189,23 @@ public class UnitFactory extends Block{
|
|||||||
@Override
|
@Override
|
||||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||||
for(ItemStack stack : consumes.items()){
|
for(ItemStack stack : consumes.items()){
|
||||||
if(item == stack.item && tile.entity.items.get(item) <= stack.amount * 2){
|
if(item == stack.item && tile.entity.items.get(item) < stack.amount * 2){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaximumAccepted(Tile tile, Item item){
|
||||||
|
for(ItemStack stack : consumes.items()){
|
||||||
|
if(item == stack.item){
|
||||||
|
return stack.amount * 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity getEntity(){
|
public TileEntity getEntity(){
|
||||||
return new UnitFactoryEntity();
|
return new UnitFactoryEntity();
|
||||||
Reference in New Issue
Block a user