Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -7,7 +7,7 @@ import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemType;
|
||||
|
||||
public class Items implements ContentList{
|
||||
public static Item stone, copper, lead, densealloy, coal, titanium, thorium, silicon, plastanium, phasematter, surgealloy,
|
||||
public static Item stone, copper, lead, densealloy, coal, titanium, thorium, silicon, plastanium, phasefabric, surgealloy,
|
||||
biomatter, sand, blastCompound, pyratite;
|
||||
|
||||
@Override
|
||||
@@ -71,9 +71,11 @@ public class Items implements ContentList{
|
||||
cost = 1.6f;
|
||||
}};
|
||||
|
||||
phasematter = new Item("phase-matter", Color.valueOf("f4ba6e")){{
|
||||
phasefabric = new Item("phase-fabric", Color.valueOf("f4ba6e")){{
|
||||
type = ItemType.material;
|
||||
cost = 1.5f;
|
||||
fluxiness = 0.9f;
|
||||
radioactivity = 0.3f;
|
||||
}};
|
||||
|
||||
surgealloy = new Item("surge-alloy", Color.valueOf("f3e979")){{
|
||||
@@ -82,7 +84,7 @@ public class Items implements ContentList{
|
||||
|
||||
biomatter = new Item("biomatter", Color.valueOf("648b55")){{
|
||||
flammability = 0.4f;
|
||||
fluxiness = 0.2f;
|
||||
fluxiness = 0.3f;
|
||||
}};
|
||||
|
||||
sand = new Item("sand", Color.valueOf("e3d39e")){{
|
||||
|
||||
@@ -36,8 +36,8 @@ public class Recipes implements ContentList{
|
||||
new Recipe(defense, DefenseBlocks.thoriumWall, new ItemStack(Items.thorium, 12));
|
||||
new Recipe(defense, DefenseBlocks.thoriumWallLarge, new ItemStack(Items.thorium, 12 * 4));
|
||||
|
||||
new Recipe(defense, DefenseBlocks.phaseWall, new ItemStack(Items.phasematter, 12));
|
||||
new Recipe(defense, DefenseBlocks.phaseWallLarge, new ItemStack(Items.phasematter, 12 * 4));
|
||||
new Recipe(defense, DefenseBlocks.phaseWall, new ItemStack(Items.phasefabric, 12));
|
||||
new Recipe(defense, DefenseBlocks.phaseWallLarge, new ItemStack(Items.phasefabric, 12 * 4));
|
||||
|
||||
new Recipe(defense, DefenseBlocks.surgeWall, new ItemStack(Items.surgealloy, 12));
|
||||
new Recipe(defense, DefenseBlocks.surgeWallLarge, new ItemStack(Items.surgealloy, 12 * 4));
|
||||
@@ -68,7 +68,7 @@ public class Recipes implements ContentList{
|
||||
//DISTRIBUTION
|
||||
new Recipe(distribution, DistributionBlocks.conveyor, new ItemStack(Items.copper, 1)).setAlwaysUnlocked(true);
|
||||
new Recipe(distribution, DistributionBlocks.titaniumconveyor, new ItemStack(Items.copper, 2), new ItemStack(Items.titanium, 1));
|
||||
new Recipe(distribution, DistributionBlocks.phaseConveyor, new ItemStack(Items.phasematter, 10), new ItemStack(Items.silicon, 15), new ItemStack(Items.lead, 20), new ItemStack(Items.densealloy, 20));
|
||||
new Recipe(distribution, DistributionBlocks.phaseConveyor, new ItemStack(Items.phasefabric, 10), new ItemStack(Items.silicon, 15), new ItemStack(Items.lead, 20), new ItemStack(Items.densealloy, 20));
|
||||
|
||||
//starter lead transportation
|
||||
new Recipe(distribution, DistributionBlocks.junction, new ItemStack(Items.copper, 2)).setAlwaysUnlocked(true);
|
||||
@@ -125,11 +125,11 @@ public class Recipes implements ContentList{
|
||||
|
||||
//generators - solar
|
||||
new Recipe(power, PowerBlocks.solarPanel, new ItemStack(Items.lead, 20), new ItemStack(Items.silicon, 30));
|
||||
new Recipe(power, PowerBlocks.largeSolarPanel, new ItemStack(Items.lead, 200), new ItemStack(Items.silicon, 290), new ItemStack(Items.phasematter, 30));
|
||||
new Recipe(power, PowerBlocks.largeSolarPanel, new ItemStack(Items.lead, 200), new ItemStack(Items.silicon, 290), new ItemStack(Items.phasefabric, 30));
|
||||
|
||||
//generators - nuclear
|
||||
new Recipe(power, PowerBlocks.thoriumReactor, new ItemStack(Items.lead, 600), new ItemStack(Items.silicon, 400), new ItemStack(Items.densealloy, 300), new ItemStack(Items.thorium, 300));
|
||||
new Recipe(power, PowerBlocks.rtgGenerator, new ItemStack(Items.lead, 200), new ItemStack(Items.silicon, 150), new ItemStack(Items.phasematter, 50), new ItemStack(Items.plastanium, 150), new ItemStack(Items.thorium, 100));
|
||||
new Recipe(power, PowerBlocks.rtgGenerator, new ItemStack(Items.lead, 200), new ItemStack(Items.silicon, 150), new ItemStack(Items.phasefabric, 50), new ItemStack(Items.plastanium, 150), new ItemStack(Items.thorium, 100));
|
||||
|
||||
new Recipe(distribution, StorageBlocks.unloader, new ItemStack(Items.densealloy, 40), new ItemStack(Items.silicon, 50));
|
||||
new Recipe(distribution, StorageBlocks.container, new ItemStack(Items.densealloy, 200));
|
||||
@@ -138,7 +138,7 @@ public class Recipes implements ContentList{
|
||||
/*new Recipe(distribution, StorageBlocks.core,
|
||||
new ItemStack(Items.copper, 2000), new ItemStack(Items.densealloy, 1500),
|
||||
new ItemStack(Items.silicon, 1500), new ItemStack(Items.thorium, 500),
|
||||
new ItemStack(Items.surgealloy, 500), new ItemStack(Items.phasematter, 750)
|
||||
new ItemStack(Items.surgealloy, 500), new ItemStack(Items.phasefabric, 750)
|
||||
);*/
|
||||
|
||||
//DRILLS, PRODUCERS
|
||||
@@ -156,7 +156,7 @@ public class Recipes implements ContentList{
|
||||
//bodies
|
||||
new Recipe(units, UpgradeBlocks.dartPad, new ItemStack(Items.lead, 150), new ItemStack(Items.copper, 150), new ItemStack(Items.silicon, 200), new ItemStack(Items.titanium, 240)).setVisible(RecipeVisibility.desktopOnly);
|
||||
new Recipe(units, UpgradeBlocks.tridentPad, new ItemStack(Items.lead, 250), new ItemStack(Items.copper, 250), new ItemStack(Items.silicon, 250), new ItemStack(Items.titanium, 300), new ItemStack(Items.plastanium, 200));
|
||||
new Recipe(units, UpgradeBlocks.javelinPad, new ItemStack(Items.lead, 350), new ItemStack(Items.silicon, 450), new ItemStack(Items.titanium, 500), new ItemStack(Items.plastanium, 400), new ItemStack(Items.phasematter, 200));
|
||||
new Recipe(units, UpgradeBlocks.javelinPad, new ItemStack(Items.lead, 350), new ItemStack(Items.silicon, 450), new ItemStack(Items.titanium, 500), new ItemStack(Items.plastanium, 400), new ItemStack(Items.phasefabric, 200));
|
||||
new Recipe(units, UpgradeBlocks.glaivePad, new ItemStack(Items.lead, 450), new ItemStack(Items.silicon, 650), new ItemStack(Items.titanium, 700), new ItemStack(Items.plastanium, 600), new ItemStack(Items.surgealloy, 200));
|
||||
|
||||
new Recipe(units, UpgradeBlocks.alphaPad, new ItemStack(Items.lead, 200), new ItemStack(Items.densealloy, 100), new ItemStack(Items.copper, 150)).setVisible(RecipeVisibility.mobileOnly);
|
||||
@@ -170,7 +170,7 @@ public class Recipes implements ContentList{
|
||||
|
||||
new Recipe(units, UnitBlocks.daggerFactory, new ItemStack(Items.lead, 90), new ItemStack(Items.silicon, 70));
|
||||
new Recipe(units, UnitBlocks.titanFactory, new ItemStack(Items.thorium, 90), new ItemStack(Items.lead, 140), new ItemStack(Items.silicon, 90));
|
||||
new Recipe(units, UnitBlocks.fortressFactory, new ItemStack(Items.thorium, 200), new ItemStack(Items.lead, 220), new ItemStack(Items.silicon, 150), new ItemStack(Items.surgealloy, 100), new ItemStack(Items.phasematter, 50));
|
||||
new Recipe(units, UnitBlocks.fortressFactory, new ItemStack(Items.thorium, 200), new ItemStack(Items.lead, 220), new ItemStack(Items.silicon, 150), new ItemStack(Items.surgealloy, 100), new ItemStack(Items.phasefabric, 50));
|
||||
|
||||
new Recipe(units, UnitBlocks.wraithFactory, new ItemStack(Items.titanium, 60), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 90));
|
||||
new Recipe(units, UnitBlocks.ghoulFactory, new ItemStack(Items.plastanium, 80), new ItemStack(Items.titanium, 100), new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 220));
|
||||
@@ -182,7 +182,7 @@ public class Recipes implements ContentList{
|
||||
//LIQUIDS
|
||||
new Recipe(liquid, LiquidBlocks.conduit, new ItemStack(Items.lead, 1)).setDependencies(CraftingBlocks.smelter);
|
||||
new Recipe(liquid, LiquidBlocks.pulseConduit, new ItemStack(Items.titanium, 1), new ItemStack(Items.lead, 1));
|
||||
new Recipe(liquid, LiquidBlocks.phaseConduit, new ItemStack(Items.phasematter, 10), new ItemStack(Items.silicon, 15), new ItemStack(Items.lead, 20), new ItemStack(Items.titanium, 20));
|
||||
new Recipe(liquid, LiquidBlocks.phaseConduit, new ItemStack(Items.phasefabric, 10), new ItemStack(Items.silicon, 15), new ItemStack(Items.lead, 20), new ItemStack(Items.titanium, 20));
|
||||
|
||||
new Recipe(liquid, LiquidBlocks.liquidRouter, new ItemStack(Items.titanium, 4), new ItemStack(Items.lead, 4));
|
||||
new Recipe(liquid, LiquidBlocks.liquidtank, new ItemStack(Items.titanium, 50), new ItemStack(Items.lead, 50));
|
||||
|
||||
@@ -52,7 +52,6 @@ public class UnitTypes implements ContentList{
|
||||
drag = 0.4f;
|
||||
hitsize = 8f;
|
||||
mass = 1.75f;
|
||||
range = 40f;
|
||||
weapon = Weapons.chainBlaster;
|
||||
health = 130;
|
||||
}};
|
||||
@@ -62,7 +61,6 @@ public class UnitTypes implements ContentList{
|
||||
speed = 0.18f;
|
||||
drag = 0.4f;
|
||||
mass = 3.5f;
|
||||
range = 10f;
|
||||
hitsize = 9f;
|
||||
rotatespeed = 0.1f;
|
||||
weapon = Weapons.flamethrower;
|
||||
@@ -75,7 +73,6 @@ public class UnitTypes implements ContentList{
|
||||
drag = 0.4f;
|
||||
mass = 5f;
|
||||
hitsize = 10f;
|
||||
range = 10f;
|
||||
rotatespeed = 0.06f;
|
||||
weaponOffsetX = 1;
|
||||
targetAir = false;
|
||||
@@ -111,6 +108,7 @@ public class UnitTypes implements ContentList{
|
||||
speed = 0.14f;
|
||||
maxVelocity = 1.3f;
|
||||
drag = 0.01f;
|
||||
range = 80f;
|
||||
isFlying = true;
|
||||
weapon = Weapons.laserBurster;
|
||||
}};
|
||||
|
||||
@@ -75,7 +75,7 @@ public class CraftingBlocks extends BlockList implements ContentList{
|
||||
|
||||
phaseWeaver = new PhaseWeaver("phase-weaver"){{
|
||||
craftEffect = BlockFx.smeltsmoke;
|
||||
result = Items.phasematter;
|
||||
result = Items.phasefabric;
|
||||
craftTime = 120f;
|
||||
powerCapacity = 50f;
|
||||
size = 2;
|
||||
|
||||
@@ -73,19 +73,19 @@ public class DefenseBlocks extends BlockList implements ContentList{
|
||||
mendProjector = new MendProjector("mend-projector"){{
|
||||
consumes.power(0.2f);
|
||||
size = 2;
|
||||
consumes.item(Items.phasematter).optional(true);
|
||||
consumes.item(Items.phasefabric).optional(true);
|
||||
}};
|
||||
|
||||
overdriveProjector = new OverdriveProjector("overdrive-projector"){{
|
||||
consumes.power(0.35f);
|
||||
size = 2;
|
||||
consumes.item(Items.phasematter).optional(true);
|
||||
consumes.item(Items.phasefabric).optional(true);
|
||||
}};
|
||||
|
||||
forceProjector = new ForceProjector("force-projector"){{
|
||||
consumes.power(0.2f);
|
||||
size = 3;
|
||||
consumes.item(Items.phasematter).optional(true);
|
||||
consumes.item(Items.phasefabric).optional(true);
|
||||
}};
|
||||
|
||||
shockMine = new ShockMine("shock-mine"){{
|
||||
|
||||
@@ -26,10 +26,7 @@ import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||
import io.anuke.ucore.core.*;
|
||||
import io.anuke.ucore.entities.EntityQuery;
|
||||
import io.anuke.ucore.modules.Module;
|
||||
import io.anuke.ucore.util.Atlas;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
import io.anuke.ucore.util.Strings;
|
||||
import io.anuke.ucore.util.Timer;
|
||||
import io.anuke.ucore.util.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -397,7 +394,7 @@ public class Control extends Module{
|
||||
}
|
||||
|
||||
}else{
|
||||
if(!state.is(State.paused) || Net.active()){
|
||||
if(!state.isPaused()){
|
||||
Timers.update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import io.anuke.mindustry.game.EventType.*;
|
||||
import io.anuke.mindustry.game.GameMode;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.game.Teams;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
@@ -21,7 +22,6 @@ import io.anuke.ucore.entities.EntityQuery;
|
||||
import io.anuke.ucore.modules.Module;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
|
||||
/**
|
||||
* Logic module.
|
||||
@@ -159,16 +159,13 @@ public class Logic extends Module{
|
||||
|
||||
if(!state.is(State.menu)){
|
||||
|
||||
if(!state.is(State.paused) || Net.active()){
|
||||
Timers.update();
|
||||
}
|
||||
|
||||
if(!Net.client() && !world.isInvalidMap()){
|
||||
updateSectors();
|
||||
checkGameOver();
|
||||
}
|
||||
|
||||
if(!state.is(State.paused) || Net.active()){
|
||||
if(!state.isPaused()){
|
||||
Timers.update();
|
||||
|
||||
if(!state.mode.disableWaveTimer && !state.mode.disableWaves){
|
||||
state.wavetime -= Timers.delta();
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.anuke.mindustry.core;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input.Keys;
|
||||
import com.badlogic.gdx.graphics.Colors;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.math.Interpolation;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import io.anuke.mindustry.Vars;
|
||||
@@ -25,7 +26,6 @@ import io.anuke.ucore.scene.ui.TextField.TextFieldFilter;
|
||||
import io.anuke.ucore.scene.ui.TooltipManager;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||
import io.anuke.ucore.util.Structs;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
import static io.anuke.ucore.scene.actions.Actions.*;
|
||||
@@ -108,12 +108,11 @@ public class UI extends SceneModule{
|
||||
@Override
|
||||
protected void loadSkin(){
|
||||
skin = new Skin(Gdx.files.internal("ui/uiskin.json"), Core.atlas);
|
||||
Structs.each(font -> {
|
||||
|
||||
for(BitmapFont font : skin.getAll(BitmapFont.class).values()){
|
||||
font.setUseIntegerPositions(false);
|
||||
font.getData().setScale(Vars.fontScale);
|
||||
font.getData().down += Unit.dp.scl(3f);
|
||||
font.getData().lineHeight -= Unit.dp.scl(3f);
|
||||
}, skin.font(), skin.getFont("default-font-chat"), skin.getFont("trad-chinese"), skin.getFont("simp-chinese"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,9 +9,10 @@ import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.entities.trait.SolidTrait;
|
||||
|
||||
public interface CarryTrait extends TeamTrait, SolidTrait, TargetTrait{
|
||||
|
||||
@Remote(called = Loc.both, targets = Loc.both, forward = true)
|
||||
static void dropSelf(Player player){
|
||||
if(player.getCarrier() != null){
|
||||
if(player != null && player.getCarrier() != null){
|
||||
player.getCarrier().dropCarry();
|
||||
}
|
||||
}
|
||||
@@ -40,24 +41,16 @@ public interface CarryTrait extends TeamTrait, SolidTrait, TargetTrait{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the thing this carrier is carrying.
|
||||
*/
|
||||
/**Returns the thing this carrier is carrying.*/
|
||||
CarriableTrait getCarry();
|
||||
|
||||
/**
|
||||
* Sets the carrying unit. Internal use only! Use {@link #carry(CarriableTrait)} to set state.
|
||||
*/
|
||||
/**Sets the carrying unit. Internal use only! Use {@link #carry(CarriableTrait)} to set state.*/
|
||||
void setCarry(CarriableTrait unit);
|
||||
|
||||
/**
|
||||
* Returns maximum mass this carrier can carry.
|
||||
*/
|
||||
/**Returns maximum mass this carrier can carry.*/
|
||||
float getCarryWeight();
|
||||
|
||||
/**
|
||||
* Drops the unit that is being carried, if applicable.
|
||||
*/
|
||||
/**Drops the unit that is being carried, if applicable.*/
|
||||
default void dropCarry(){
|
||||
carry(null);
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
||||
}
|
||||
|
||||
public void targetClosest(){
|
||||
target = Units.getClosestTarget(team, x, y, getWeapon().getAmmo().getRange(), u -> type.targetAir || !u.isFlying());
|
||||
target = Units.getClosestTarget(team, x, y, Math.max(getWeapon().getAmmo().getRange(), type.range), u -> type.targetAir || !u.isFlying());
|
||||
}
|
||||
|
||||
public TileEntity getClosestEnemyCore(){
|
||||
|
||||
@@ -76,7 +76,7 @@ public abstract class FlyingUnit extends BaseUnit implements CarryTrait{
|
||||
attack(150f);
|
||||
|
||||
if((Mathf.angNear(angleTo(target), rotation, 15f) || !getWeapon().getAmmo().bullet.keepVelocity) //bombers don't care about rotation
|
||||
&& distanceTo(target) < getWeapon().getAmmo().getRange()){
|
||||
&& distanceTo(target) < Math.max(getWeapon().getAmmo().getRange(), type.range)){
|
||||
AmmoType ammo = getWeapon().getAmmo();
|
||||
|
||||
Vector2 to = Predict.intercept(FlyingUnit.this, target, ammo.bullet.speed);
|
||||
|
||||
@@ -29,7 +29,7 @@ public class UnitType extends UnlockableContent{
|
||||
public float hitsize = 7f;
|
||||
public float hitsizeTile = 4f;
|
||||
public float speed = 0.4f;
|
||||
public float range = 160;
|
||||
public float range = 0;
|
||||
public float rotatespeed = 0.2f;
|
||||
public float baseRotateSpeed = 0.1f;
|
||||
public float mass = 1f;
|
||||
|
||||
@@ -79,7 +79,7 @@ public abstract class Mission{
|
||||
|
||||
public void onComplete(){
|
||||
if(showComplete && !headless){
|
||||
ui.hudfrag.showText("[LIGHT_GRAY]"+menuDisplayString() + ":\n" + Bundles.get("text.mission.complete"));
|
||||
threads.runGraphics(() -> ui.hudfrag.showText("[LIGHT_GRAY]"+menuDisplayString() + ":\n" + Bundles.get("text.mission.complete")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,10 +29,6 @@ public class NetworkIO{
|
||||
public static void writeWorld(Player player, OutputStream os){
|
||||
|
||||
try(DataOutputStream stream = new DataOutputStream(os)){
|
||||
|
||||
stream.writeFloat(Timers.time()); //timer time
|
||||
stream.writeLong(TimeUtils.millis()); //timestamp
|
||||
|
||||
//--GENERAL STATE--
|
||||
stream.writeByte(state.mode.ordinal()); //gamemode
|
||||
stream.writeUTF(world.getMap().name); //map name
|
||||
@@ -156,11 +152,7 @@ public class NetworkIO{
|
||||
Player player = players[0];
|
||||
|
||||
try(DataInputStream stream = new DataInputStream(is)){
|
||||
float timerTime = stream.readFloat();
|
||||
long timestamp = stream.readLong();
|
||||
|
||||
Timers.clear();
|
||||
Timers.resetTime(timerTime + (TimeUtils.timeSinceMillis(timestamp) / 1000f) * 60f);
|
||||
|
||||
//general state
|
||||
byte mode = stream.readByte();
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.anuke.mindustry.ui;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.function.Supplier;
|
||||
import io.anuke.ucore.scene.ui.Image;
|
||||
import io.anuke.ucore.scene.ui.layout.Stack;
|
||||
@@ -14,7 +15,7 @@ public class ItemImage extends Stack{
|
||||
public ItemImage(TextureRegion region, Supplier<CharSequence> text){
|
||||
Table t = new Table().left().bottom();
|
||||
|
||||
t.label(text).color(Color.DARK_GRAY).padBottom(-20).get().setFontScale(Unit.dp.scl(0.5f));
|
||||
t.label(text).color(Color.DARK_GRAY).padBottom(-Core.skin.font().getData().capHeight * 2).get().setFontScale(Unit.dp.scl(0.5f));
|
||||
t.row();
|
||||
t.label(text).get().setFontScale(Unit.dp.scl(0.5f));
|
||||
|
||||
@@ -25,7 +26,7 @@ public class ItemImage extends Stack{
|
||||
public ItemImage(ItemStack stack){
|
||||
Table t = new Table().left().bottom();
|
||||
|
||||
t.add(stack.amount + "").color(Color.DARK_GRAY).padBottom(-20).get().setFontScale(Unit.dp.scl(0.5f));
|
||||
t.add(stack.amount + "").color(Color.DARK_GRAY).padBottom(-Core.skin.font().getData().capHeight * 2).get().setFontScale(Unit.dp.scl(0.5f));
|
||||
t.row();
|
||||
t.add(stack.amount + "").get().setFontScale(Unit.dp.scl(0.5f));
|
||||
|
||||
|
||||
@@ -40,9 +40,7 @@ public abstract class BaseBlock extends MappableContent{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount of items this block can accept.
|
||||
*/
|
||||
/**Returns the amount of items this block can accept.*/
|
||||
public int acceptStack(Item item, int amount, Tile tile, Unit source){
|
||||
if(acceptItem(item, tile, tile) && hasItems && (source == null || source.getTeam() == tile.getTeam())){
|
||||
return Math.min(getMaximumAccepted(tile, item), amount);
|
||||
@@ -52,12 +50,10 @@ public abstract class BaseBlock extends MappableContent{
|
||||
}
|
||||
|
||||
public int getMaximumAccepted(Tile tile, Item item){
|
||||
return itemCapacity - (tile.entity.items.total() - tile.entity.items.get(item));
|
||||
return itemCapacity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a stack from this inventory, and return the amount removed.
|
||||
*/
|
||||
/**Remove a stack from this inventory, and return the amount removed.*/
|
||||
public int removeStack(Tile tile, Item item, int amount){
|
||||
tile.entity.noSleep();
|
||||
tile.entity.items.remove(item, amount);
|
||||
@@ -88,7 +84,8 @@ public abstract class BaseBlock extends MappableContent{
|
||||
}
|
||||
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
return tile.entity != null && consumes.has(ConsumeItem.class) && consumes.item() == item && tile.entity.items.get(item) < getMaximumAccepted(tile, item);
|
||||
return tile.entity != null && consumes.has(ConsumeItem.class) && consumes.item() == item &&
|
||||
tile.entity.items.get(item) < getMaximumAccepted(tile, item);
|
||||
}
|
||||
|
||||
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
|
||||
|
||||
@@ -89,7 +89,7 @@ public class ForceProjector extends Block {
|
||||
|
||||
entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, (float)entity.items.get(consumes.item()) / itemCapacity, 0.1f);
|
||||
|
||||
if(!entity.broken && entity.timer.get(timerUse, phaseUseTime) && entity.items.total() > 0){
|
||||
if(entity.cons.valid() && !entity.broken && entity.timer.get(timerUse, phaseUseTime) && entity.items.total() > 0){
|
||||
entity.items.remove(consumes.item(), 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public class MendProjector extends Block{
|
||||
|
||||
entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, (float)entity.items.get(consumes.item()) / itemCapacity, 0.1f);
|
||||
|
||||
if(entity.timer.get(timerUse, useTime) && entity.items.total() > 0){
|
||||
if(entity.cons.valid() && entity.timer.get(timerUse, useTime) && entity.items.total() > 0){
|
||||
entity.items.remove(consumes.item(), 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,12 @@ public class PowerNode extends PowerBlock{
|
||||
public void playerPlaced(Tile tile){
|
||||
Tile before = world.tile(lastPlaced);
|
||||
if(linkValid(tile, before) && before.block() instanceof PowerNode){
|
||||
for(Tile near : before.entity.proximity()){
|
||||
if(near.target() == tile){
|
||||
lastPlaced = tile.packedPosition();
|
||||
return;
|
||||
}
|
||||
}
|
||||
Call.linkPowerNodes(null, tile, before);
|
||||
}
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ public class PowerSmelter extends PowerBlock{
|
||||
|
||||
@Override
|
||||
public int getMaximumAccepted(Tile tile, Item item){
|
||||
return itemCapacity - tile.entity.items.get(item);
|
||||
return itemCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -154,7 +154,7 @@ public class Smelter extends Block{
|
||||
|
||||
@Override
|
||||
public int getMaximumAccepted(Tile tile, Item item){
|
||||
return itemCapacity - tile.entity.items.get(item);
|
||||
return itemCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user