Changed inventory system to use real core inventory
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 246 B After Width: | Height: | Size: 238 B |
Binary file not shown.
|
Before Width: | Height: | Size: 159 B After Width: | Height: | Size: 168 B |
Binary file not shown.
|
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 104 KiB |
@@ -1,7 +1,7 @@
|
|||||||
#Autogenerated file. Do not modify.
|
#Autogenerated file. Do not modify.
|
||||||
#Fri Apr 13 23:52:40 EDT 2018
|
#Sat Apr 14 11:12:26 EDT 2018
|
||||||
version=release
|
version=release
|
||||||
androidBuildCode=917
|
androidBuildCode=918
|
||||||
name=Mindustry
|
name=Mindustry
|
||||||
code=3.5
|
code=3.5
|
||||||
build=custom build
|
build=custom build
|
||||||
|
|||||||
@@ -142,8 +142,6 @@ public class Control extends Module{
|
|||||||
|
|
||||||
Core.camera.position.set(player.x, player.y, 0);
|
Core.camera.position.set(player.x, player.y, 0);
|
||||||
|
|
||||||
ui.hudfrag.updateItems();
|
|
||||||
|
|
||||||
state.set(State.playing);
|
state.set(State.playing);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -159,7 +157,6 @@ public class Control extends Module{
|
|||||||
respawntime = -1;
|
respawntime = -1;
|
||||||
hiscore = false;
|
hiscore = false;
|
||||||
|
|
||||||
ui.hudfrag.updateItems();
|
|
||||||
ui.hudfrag.fadeRespawn(false);
|
ui.hudfrag.fadeRespawn(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -324,11 +321,6 @@ public class Control extends Module{
|
|||||||
|
|
||||||
saves.update();
|
saves.update();
|
||||||
|
|
||||||
if(state.inventory.isUpdated() && (Timers.get("updateItems", 8) || state.is(State.paused))){
|
|
||||||
ui.hudfrag.updateItems();
|
|
||||||
state.inventory.setUpdated(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!state.is(State.menu)){
|
if(!state.is(State.menu)){
|
||||||
input.update();
|
input.update();
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ public class Logic extends Module {
|
|||||||
|
|
||||||
if(state.mode.infiniteResources){
|
if(state.mode.infiniteResources){
|
||||||
state.inventory.fill();
|
state.inventory.fill();
|
||||||
|
}else{
|
||||||
|
state.inventory.clearItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
Events.fire(PlayEvent.class);
|
Events.fire(PlayEvent.class);
|
||||||
@@ -53,7 +55,6 @@ public class Logic extends Module {
|
|||||||
state.wavetime = wavespace * state.difficulty.timeScaling;
|
state.wavetime = wavespace * state.difficulty.timeScaling;
|
||||||
state.enemies = 0;
|
state.enemies = 0;
|
||||||
state.gameOver = false;
|
state.gameOver = false;
|
||||||
state.inventory.clearItems();
|
|
||||||
state.teams = new TeamInfo();
|
state.teams = new TeamInfo();
|
||||||
state.teams.add(Team.blue, true);
|
state.teams.add(Team.blue, true);
|
||||||
state.teams.add(Team.red, false);
|
state.teams.add(Team.red, false);
|
||||||
|
|||||||
@@ -144,13 +144,11 @@ public class NetClient extends Module {
|
|||||||
|
|
||||||
Net.handleClient(StateSyncPacket.class, packet -> {
|
Net.handleClient(StateSyncPacket.class, packet -> {
|
||||||
|
|
||||||
System.arraycopy(packet.items, 0, state.inventory.getItems(), 0, packet.items.length);
|
System.arraycopy(packet.items, 0, state.inventory.writeItems(), 0, packet.items.length);
|
||||||
|
|
||||||
state.enemies = packet.enemies;
|
state.enemies = packet.enemies;
|
||||||
state.wavetime = packet.countdown;
|
state.wavetime = packet.countdown;
|
||||||
state.wave = packet.wave;
|
state.wave = packet.wave;
|
||||||
|
|
||||||
ui.hudfrag.updateItems();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Net.handleClient(PlacePacket.class, (packet) -> {
|
Net.handleClient(PlacePacket.class, (packet) -> {
|
||||||
|
|||||||
@@ -446,7 +446,7 @@ public class NetServer extends Module{
|
|||||||
|
|
||||||
if(timer.get(timerStateSync, itemSyncTime)){
|
if(timer.get(timerStateSync, itemSyncTime)){
|
||||||
StateSyncPacket packet = new StateSyncPacket();
|
StateSyncPacket packet = new StateSyncPacket();
|
||||||
packet.items = state.inventory.getItems();
|
packet.items = state.inventory.readItems();
|
||||||
packet.countdown = state.wavetime;
|
packet.countdown = state.wavetime;
|
||||||
packet.enemies = state.enemies;
|
packet.enemies = state.enemies;
|
||||||
packet.wave = state.wave;
|
packet.wave = state.wave;
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ public class Player extends Unit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
float backTrns = 4f, itemSize = 5f;
|
float backTrns = 4f, itemSize = 5f;
|
||||||
if(inventory.hasItem() && !control.input().isDroppingItem()){
|
if(inventory.hasItem()){
|
||||||
ItemStack stack = inventory.getItem();
|
ItemStack stack = inventory.getItem();
|
||||||
Draw.rect(stack.item.region, x + Angles.trnsx(rotation + 180f, backTrns), y + Angles.trnsy(rotation + 180f, backTrns), itemSize, itemSize, rotation);
|
Draw.rect(stack.item.region, x + Angles.trnsx(rotation + 180f, backTrns), y + Angles.trnsy(rotation + 180f, backTrns), itemSize, itemSize, rotation);
|
||||||
//Draw.tint(Color.WHITE);
|
//Draw.tint(Color.WHITE);
|
||||||
|
|||||||
@@ -1,33 +1,27 @@
|
|||||||
package io.anuke.mindustry.game;
|
package io.anuke.mindustry.game;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
import com.badlogic.gdx.utils.ObjectSet;
|
||||||
import io.anuke.mindustry.content.Items;
|
import io.anuke.mindustry.content.Items;
|
||||||
|
import io.anuke.mindustry.game.TeamInfo.TeamData;
|
||||||
import io.anuke.mindustry.resource.Item;
|
import io.anuke.mindustry.resource.Item;
|
||||||
import io.anuke.mindustry.resource.ItemStack;
|
import io.anuke.mindustry.resource.ItemStack;
|
||||||
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.debug;
|
import static io.anuke.mindustry.Vars.debug;
|
||||||
|
import static io.anuke.mindustry.Vars.state;
|
||||||
|
|
||||||
public class Inventory {
|
public class Inventory {
|
||||||
private final int[] items = new int[Item.getAllItems().size];
|
private final int[] empty = new int[Item.getAllItems().size];
|
||||||
private boolean updated;
|
|
||||||
|
|
||||||
public boolean isUpdated(){
|
|
||||||
return updated;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdated(boolean updated){
|
|
||||||
this.updated = updated;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearItems(){
|
public void clearItems(){
|
||||||
updated = true;
|
Arrays.fill(items(), 0);
|
||||||
Arrays.fill(items, 0);
|
|
||||||
|
|
||||||
|
|
||||||
if(debug){
|
if(debug){
|
||||||
for(Item item : Item.getAllItems()){
|
for(Item item : Item.getAllItems()){
|
||||||
if(item.material) items[item.id] = 99999;
|
if(item.material) items()[item.id] = 99999;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
addItem(Items.iron, 40);
|
addItem(Items.iron, 40);
|
||||||
@@ -35,16 +29,15 @@ public class Inventory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void fill(){
|
public void fill(){
|
||||||
Arrays.fill(items, 999999999);
|
Arrays.fill(items(), 999999999);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAmount(Item item){
|
public int getAmount(Item item){
|
||||||
return items[item.id];
|
return items()[item.id];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addItem(Item item, int amount){
|
public void addItem(Item item, int amount){
|
||||||
updated = true;
|
items()[item.id] += amount;
|
||||||
items[item.id] += amount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasItems(ItemStack[] items){
|
public boolean hasItems(ItemStack[] items){
|
||||||
@@ -62,29 +55,42 @@ public class Inventory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasItem(ItemStack req){
|
public boolean hasItem(ItemStack req){
|
||||||
updated = true;
|
return items()[req.item.id] >= req.amount;
|
||||||
return items[req.item.id] >= req.amount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasItem(Item item, int amount){
|
public boolean hasItem(Item item, int amount){
|
||||||
updated = true;
|
return items()[item.id] >= amount;
|
||||||
return items[item.id] >= amount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeItem(ItemStack req){
|
public void removeItem(ItemStack req){
|
||||||
updated = true;
|
items()[req.item.id] -= req.amount;
|
||||||
items[req.item.id] -= req.amount;
|
if(items()[req.item.id] < 0) items()[req.item.id] = 0; //prevents negative item glitches in multiplayer
|
||||||
if(items[req.item.id] < 0) items[req.item.id] = 0; //prevents negative item glitches in multiplayer
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeItems(ItemStack... reqs){
|
public void removeItems(ItemStack... reqs){
|
||||||
updated = true;
|
|
||||||
for(ItemStack req : reqs)
|
for(ItemStack req : reqs)
|
||||||
removeItem(req);
|
removeItem(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int[] writeItems(){
|
||||||
|
return items();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] readItems(){
|
||||||
|
return items();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public int[] getItems(){
|
public int[] getItems(){
|
||||||
updated = true;
|
updated = true;
|
||||||
return items;
|
return items();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
private int[] items(){
|
||||||
|
ObjectSet<TeamData> set = state.teams.getTeams(true);
|
||||||
|
if(set.size == 0) return empty;
|
||||||
|
Array<Tile> tiles = set.first().cores;
|
||||||
|
if(tiles.size == 0) return empty;
|
||||||
|
return tiles.first().entity.inventory.items;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import io.anuke.mindustry.game.Difficulty;
|
|||||||
import io.anuke.mindustry.game.GameMode;
|
import io.anuke.mindustry.game.GameMode;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
import io.anuke.mindustry.io.SaveFileVersion;
|
import io.anuke.mindustry.io.SaveFileVersion;
|
||||||
import io.anuke.mindustry.resource.Item;
|
|
||||||
import io.anuke.mindustry.resource.Upgrade;
|
import io.anuke.mindustry.resource.Upgrade;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
@@ -25,7 +24,6 @@ import io.anuke.ucore.util.Bits;
|
|||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
@@ -95,20 +93,6 @@ public class Save16 extends SaveFileVersion {
|
|||||||
for(int i = 0; i < b; i ++) stream.readByte();
|
for(int i = 0; i < b; i ++) stream.readByte();
|
||||||
}
|
}
|
||||||
|
|
||||||
//inventory
|
|
||||||
|
|
||||||
int totalItems = stream.readByte();
|
|
||||||
|
|
||||||
Arrays.fill(state.inventory.getItems(), 0);
|
|
||||||
|
|
||||||
for(int i = 0; i < totalItems; i ++){
|
|
||||||
Item item = Item.getByID(stream.readByte());
|
|
||||||
int amount = stream.readInt();
|
|
||||||
state.inventory.getItems()[item.id] = amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!headless) ui.hudfrag.updateItems();
|
|
||||||
|
|
||||||
//enemies
|
//enemies
|
||||||
|
|
||||||
byte teams = stream.readByte();
|
byte teams = stream.readByte();
|
||||||
@@ -242,26 +226,6 @@ public class Save16 extends SaveFileVersion {
|
|||||||
stream.writeByte(0);
|
stream.writeByte(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--INVENTORY--
|
|
||||||
|
|
||||||
int l = state.inventory.getItems().length;
|
|
||||||
int itemsize = 0;
|
|
||||||
|
|
||||||
for(int i = 0; i < l; i ++){
|
|
||||||
if(state.inventory.getItems()[i] > 0){
|
|
||||||
itemsize ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.writeByte(itemsize); //amount of items
|
|
||||||
|
|
||||||
for(int i = 0; i < l; i ++){
|
|
||||||
if(state.inventory.getItems()[i] > 0){
|
|
||||||
stream.writeByte(i); //item ID
|
|
||||||
stream.writeInt(state.inventory.getItems()[i]); //item amount
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--ENEMIES--
|
//--ENEMIES--
|
||||||
stream.writeByte(Team.values().length); //amount of total teams (backwards compatibility)
|
stream.writeByte(Team.values().length); //amount of total teams (backwards compatibility)
|
||||||
|
|
||||||
|
|||||||
@@ -41,12 +41,6 @@ public class NetworkIO {
|
|||||||
stream.writeInt(player.id); //player remap ID
|
stream.writeInt(player.id); //player remap ID
|
||||||
stream.writeBoolean(player.isAdmin);
|
stream.writeBoolean(player.isAdmin);
|
||||||
|
|
||||||
//--INVENTORY--
|
|
||||||
|
|
||||||
for(int i = 0; i < state.inventory.getItems().length; i ++){ //items
|
|
||||||
stream.writeInt(state.inventory.getItems()[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.writeByte(upgrades.size); //upgrade data
|
stream.writeByte(upgrades.size); //upgrade data
|
||||||
|
|
||||||
for(int i = 0; i < upgrades.size; i ++){
|
for(int i = 0; i < upgrades.size; i ++){
|
||||||
@@ -120,13 +114,6 @@ public class NetworkIO {
|
|||||||
int pid = stream.readInt();
|
int pid = stream.readInt();
|
||||||
boolean admin = stream.readBoolean();
|
boolean admin = stream.readBoolean();
|
||||||
|
|
||||||
//inventory
|
|
||||||
for(int i = 0; i < state.inventory.getItems().length; i ++){
|
|
||||||
state.inventory.getItems()[i] = stream.readInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
ui.hudfrag.updateItems();
|
|
||||||
|
|
||||||
control.upgrades().getWeapons().clear();
|
control.upgrades().getWeapons().clear();
|
||||||
control.upgrades().getWeapons().add(Weapons.blaster);
|
control.upgrades().getWeapons().add(Weapons.blaster);
|
||||||
|
|
||||||
|
|||||||
@@ -94,15 +94,7 @@ public class LevelDialog extends FloatingDialog{
|
|||||||
Table inset = new Table("pane-button");
|
Table inset = new Table("pane-button");
|
||||||
inset.add("[accent]" + Bundles.get("map."+map.name+".name", map.name)).pad(3f);
|
inset.add("[accent]" + Bundles.get("map."+map.name+".name", map.name)).pad(3f);
|
||||||
inset.row();
|
inset.row();
|
||||||
inset.label((() ->{
|
inset.label((() -> Bundles.format("text.level.highscore", Settings.getInt("hiscore" + map.name, 0)))).pad(3f);
|
||||||
try{
|
|
||||||
return Bundles.format("text.level.highscore", Settings.getInt("hiscore" + map.name));
|
|
||||||
}catch (Exception e){
|
|
||||||
Settings.defaults("hiscore" + map.name, 1);
|
|
||||||
return Bundles.format("text.level.highscore", 0);
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
.pad(3f);
|
|
||||||
inset.pack();
|
inset.pack();
|
||||||
|
|
||||||
float images = 154f;
|
float images = 154f;
|
||||||
|
|||||||
@@ -5,10 +5,14 @@ import com.badlogic.gdx.graphics.Colors;
|
|||||||
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 com.badlogic.gdx.utils.IntSet;
|
||||||
import io.anuke.mindustry.content.Recipes;
|
import io.anuke.mindustry.content.Recipes;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.input.InputHandler;
|
import io.anuke.mindustry.input.InputHandler;
|
||||||
import io.anuke.mindustry.resource.*;
|
import io.anuke.mindustry.resource.Item;
|
||||||
|
import io.anuke.mindustry.resource.ItemStack;
|
||||||
|
import io.anuke.mindustry.resource.Recipe;
|
||||||
|
import io.anuke.mindustry.resource.Section;
|
||||||
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.BlockStats;
|
import io.anuke.mindustry.world.BlockStats;
|
||||||
@@ -24,6 +28,7 @@ import io.anuke.ucore.scene.ui.*;
|
|||||||
import io.anuke.ucore.scene.ui.layout.Stack;
|
import io.anuke.ucore.scene.ui.layout.Stack;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.util.Bundles;
|
import io.anuke.ucore.util.Bundles;
|
||||||
|
import io.anuke.ucore.util.Log;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
import io.anuke.ucore.util.Strings;
|
import io.anuke.ucore.util.Strings;
|
||||||
|
|
||||||
@@ -34,6 +39,7 @@ public class BlocksFragment implements Fragment{
|
|||||||
private Stack stack = new Stack();
|
private Stack stack = new Stack();
|
||||||
private boolean shown = true;
|
private boolean shown = true;
|
||||||
private Recipe hoveredDescriptionRecipe;
|
private Recipe hoveredDescriptionRecipe;
|
||||||
|
private IntSet itemset = new IntSet();
|
||||||
|
|
||||||
public void build(){
|
public void build(){
|
||||||
InputHandler input = control.input();
|
InputHandler input = control.input();
|
||||||
@@ -48,6 +54,16 @@ public class BlocksFragment implements Fragment{
|
|||||||
|
|
||||||
itemtable = new Table("button");
|
itemtable = new Table("button");
|
||||||
itemtable.setVisible(() -> input.recipe == null && !state.mode.infiniteResources);
|
itemtable.setVisible(() -> input.recipe == null && !state.mode.infiniteResources);
|
||||||
|
itemtable.update(() -> {
|
||||||
|
int[] items = state.inventory.readItems();
|
||||||
|
for(int i = 0; i < items.length; i ++){
|
||||||
|
if(itemset.contains(items[i]) != (items[i] > 0)){
|
||||||
|
Log.info("Updating items.");
|
||||||
|
updateItems();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
desctable = new Table("button");
|
desctable = new Table("button");
|
||||||
desctable.setVisible(() -> hoveredDescriptionRecipe != null || input.recipe != null);
|
desctable.setVisible(() -> hoveredDescriptionRecipe != null || input.recipe != null);
|
||||||
@@ -326,23 +342,27 @@ public class BlocksFragment implements Fragment{
|
|||||||
d.show();
|
d.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateItems(){
|
private void updateItems(){
|
||||||
|
|
||||||
itemtable.clear();
|
itemtable.clear();
|
||||||
itemtable.left();
|
itemtable.left();
|
||||||
|
|
||||||
if(state.mode.infiniteResources){
|
if(state.mode.infiniteResources){
|
||||||
return;
|
return;
|
||||||
}
|
};
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
int[] items = state.inventory.readItems();
|
||||||
|
|
||||||
for(int i = 0; i < state.inventory.getItems().length; i ++){
|
for(int i = 0; i < items.length; i ++){
|
||||||
int amount = state.inventory.getItems()[i];
|
int amount = items[i];
|
||||||
if(amount == 0) continue;
|
if(amount == 0){
|
||||||
String formatted = amount > 99999999 ? "inf" : format(amount);
|
itemset.remove(i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
itemset.add(i);
|
||||||
Image image = new Image(Item.getByID(i).region);
|
Image image = new Image(Item.getByID(i).region);
|
||||||
Label label = new Label(formatted);
|
Label label = new Label(() -> format(amount));
|
||||||
label.setFontScale(fontscale*1.5f);
|
label.setFontScale(fontscale*1.5f);
|
||||||
itemtable.add(image).size(8*3);
|
itemtable.add(image).size(8*3);
|
||||||
itemtable.add(label).expandX().left();
|
itemtable.add(label).expandX().left();
|
||||||
@@ -351,7 +371,9 @@ public class BlocksFragment implements Fragment{
|
|||||||
}
|
}
|
||||||
|
|
||||||
String format(int number){
|
String format(int number){
|
||||||
if(number > 1000000) {
|
if(number > 99999999){
|
||||||
|
return "inf";
|
||||||
|
}else if(number > 1000000) {
|
||||||
return Strings.toFixed(number/1000000f, 1) + "[gray]mil";
|
return Strings.toFixed(number/1000000f, 1) + "[gray]mil";
|
||||||
}else if(number > 10000){
|
}else if(number > 10000){
|
||||||
return number/1000 + "[gray]k";
|
return number/1000 + "[gray]k";
|
||||||
|
|||||||
@@ -221,10 +221,6 @@ public class HudFragment implements Fragment{
|
|||||||
l.setTouchable(!paused ? Touchable.enabled : Touchable.disabled);
|
l.setTouchable(!paused ? Touchable.enabled : Touchable.disabled);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateItems(){
|
|
||||||
blockfrag.updateItems();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void fadeRespawn(boolean in){
|
public void fadeRespawn(boolean in){
|
||||||
respawntable.addAction(Actions.color(in ? new Color(0, 0, 0, 0.3f) : Color.CLEAR, 0.3f));
|
respawntable.addAction(Actions.color(in ? new Color(0, 0, 0, 0.3f) : Color.CLEAR, 0.3f));
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import io.anuke.mindustry.world.Tile;
|
|||||||
import static io.anuke.mindustry.Vars.state;
|
import static io.anuke.mindustry.Vars.state;
|
||||||
|
|
||||||
public class CoreBlock extends StorageBlock {
|
public class CoreBlock extends StorageBlock {
|
||||||
protected int capacity = 1000;
|
|
||||||
|
|
||||||
public CoreBlock(String name) {
|
public CoreBlock(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
@@ -16,7 +15,8 @@ public class CoreBlock extends StorageBlock {
|
|||||||
destructible = true;
|
destructible = true;
|
||||||
unbreakable = true;
|
unbreakable = true;
|
||||||
size = 3;
|
size = 3;
|
||||||
hasInventory = false;
|
hasInventory = true;
|
||||||
|
itemCapacity = 2000;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDestroyed(Tile tile){
|
public void onDestroyed(Tile tile){
|
||||||
@@ -30,8 +30,9 @@ public class CoreBlock extends StorageBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleItem(Item item, Tile tile, Tile source){
|
public void handleItem(Item item, Tile tile, Tile source){
|
||||||
if(Net.server() || !Net.active()) state.inventory.addItem(item, 1);
|
if(Net.server() || !Net.active()) super.handleItem(item, tile, source);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||||
@@ -57,5 +58,5 @@ public class CoreBlock extends StorageBlock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user