Down to less than 100 errors
This commit is contained in:
@@ -76,10 +76,11 @@ public class Blocks implements ContentList{
|
|||||||
|
|
||||||
//units
|
//units
|
||||||
commandCenter, draugFactory, spiritFactory, phantomFactory, wraithFactory, ghoulFactory, revenantFactory, daggerFactory, crawlerFactory, titanFactory,
|
commandCenter, draugFactory, spiritFactory, phantomFactory, wraithFactory, ghoulFactory, revenantFactory, daggerFactory, crawlerFactory, titanFactory,
|
||||||
fortressFactory, repairPoint,
|
fortressFactory, repairPoint
|
||||||
|
|
||||||
//upgrades
|
//upgrades
|
||||||
dartPad, alphaPad, deltaPad, tauPad, omegaPad, javelinPad, tridentPad, glaivePad;
|
//dartPad, alphaPad, deltaPad, tauPad, omegaPad, javelinPad, tridentPad, glaivePad;
|
||||||
|
;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(){
|
public void load(){
|
||||||
@@ -1285,13 +1286,13 @@ public class Blocks implements ContentList{
|
|||||||
size = 5;
|
size = 5;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
vault = new Vault("vault"){{
|
vault = new StorageBlock("vault"){{
|
||||||
requirements(Category.effect, ItemStack.with(Items.titanium, 250, Items.thorium, 125));
|
requirements(Category.effect, ItemStack.with(Items.titanium, 250, Items.thorium, 125));
|
||||||
size = 3;
|
size = 3;
|
||||||
itemCapacity = 1000;
|
itemCapacity = 1000;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
container = new Vault("container"){{
|
container = new StorageBlock("container"){{
|
||||||
requirements(Category.effect, ItemStack.with(Items.titanium, 100));
|
requirements(Category.effect, ItemStack.with(Items.titanium, 100));
|
||||||
size = 2;
|
size = 2;
|
||||||
itemCapacity = 300;
|
itemCapacity = 300;
|
||||||
@@ -1764,6 +1765,8 @@ public class Blocks implements ContentList{
|
|||||||
//endregion
|
//endregion
|
||||||
//region upgrades
|
//region upgrades
|
||||||
|
|
||||||
|
//mechs are dead for now
|
||||||
|
/*
|
||||||
dartPad = new MechPad("dart-ship-pad"){{
|
dartPad = new MechPad("dart-ship-pad"){{
|
||||||
requirements(Category.upgrade, ItemStack.with(Items.lead, 100, Items.graphite, 50, Items.copper, 75));
|
requirements(Category.upgrade, ItemStack.with(Items.lead, 100, Items.graphite, 50, Items.copper, 75));
|
||||||
mech = UnitTypes.dart;
|
mech = UnitTypes.dart;
|
||||||
@@ -1818,7 +1821,7 @@ public class Blocks implements ContentList{
|
|||||||
mech = UnitTypes.glaive;
|
mech = UnitTypes.glaive;
|
||||||
size = 3;
|
size = 3;
|
||||||
consumes.power(1.2f);
|
consumes.power(1.2f);
|
||||||
}};
|
}};*/
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
//region sandbox
|
//region sandbox
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ abstract class FireComp implements Timedc, Posc, Firec{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(baseFlammability < 0 || block != tile.block()){
|
if(baseFlammability < 0 || block != tile.block()){
|
||||||
baseFlammability = tile.block().getFlammability(tile);
|
baseFlammability = tile.getFlammability();
|
||||||
block = tile.block();
|
block = tile.block();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitbox
|
|||||||
|
|
||||||
if(tile != null){
|
if(tile != null){
|
||||||
//unit block update
|
//unit block update
|
||||||
tile.block().unitOn(tile, this);
|
tile.unitOn(this);
|
||||||
|
|
||||||
//apply damage
|
//apply damage
|
||||||
if(floor.damageTaken > 0f){
|
if(floor.damageTaken > 0f){
|
||||||
|
|||||||
@@ -207,9 +207,9 @@ public class FloorRenderer implements Disposable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(tile.block().cacheLayer == layer && layer == CacheLayer.walls && !(tile.isDarkened() && tile.rotation() >= 5)){
|
if(tile.block().cacheLayer == layer && layer == CacheLayer.walls && !(tile.isDarkened() && tile.rotation() >= 5)){
|
||||||
tile.block().draw(tile);
|
tile.block().drawBase(tile);
|
||||||
}else if(floor.cacheLayer == layer && (world.isAccessible(tile.x, tile.y) || tile.block().cacheLayer != CacheLayer.walls || !tile.block().fillsTile)){
|
}else if(floor.cacheLayer == layer && (world.isAccessible(tile.x, tile.y) || tile.block().cacheLayer != CacheLayer.walls || !tile.block().fillsTile)){
|
||||||
floor.draw(tile);
|
floor.drawBase(tile);
|
||||||
}else if(floor.cacheLayer.ordinal() < layer.ordinal() && layer != CacheLayer.walls){
|
}else if(floor.cacheLayer.ordinal() < layer.ordinal() && layer != CacheLayer.walls){
|
||||||
floor.drawNonLayer(tile);
|
floor.drawNonLayer(tile);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,18 +186,18 @@ public class MenuRenderer implements Disposable{
|
|||||||
batch.beginCache();
|
batch.beginCache();
|
||||||
|
|
||||||
for(Tile tile : world.tiles){
|
for(Tile tile : world.tiles){
|
||||||
tile.floor().draw(tile);
|
tile.floor().drawBase(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Tile tile : world.tiles){
|
for(Tile tile : world.tiles){
|
||||||
tile.overlay().draw(tile);
|
tile.overlay().drawBase(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
cacheFloor = batch.endCache();
|
cacheFloor = batch.endCache();
|
||||||
batch.beginCache();
|
batch.beginCache();
|
||||||
|
|
||||||
for(Tile tile : world.tiles){
|
for(Tile tile : world.tiles){
|
||||||
tile.block().draw(tile);
|
tile.block().drawBase(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
cacheWall = batch.endCache();
|
cacheWall = batch.endCache();
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ public class MinimapRenderer implements Disposable{
|
|||||||
private int colorFor(Tile tile){
|
private int colorFor(Tile tile){
|
||||||
if(tile == null) return 0;
|
if(tile == null) return 0;
|
||||||
tile = tile.link();
|
tile = tile.link();
|
||||||
int bc = tile.block().minimapColor(tile);
|
int bc = tile.minimapColor();
|
||||||
Color color = Tmp.c1.set(bc == 0 ? MapIO.colorFor(tile.floor(), tile.block(), tile.overlay(), tile.team()) : bc);
|
Color color = Tmp.c1.set(bc == 0 ? MapIO.colorFor(tile.floor(), tile.block(), tile.overlay(), tile.team()) : bc);
|
||||||
color.mul(1f - Mathf.clamp(world.getDarkness(tile.x, tile.y) / 4f));
|
color.mul(1f - Mathf.clamp(world.getDarkness(tile.x, tile.y) / 4f));
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class OverlayRenderer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
Groups.unit.each(unit -> {
|
Groups.unit.each(unit -> {
|
||||||
if(unit != player && unit.team() != player.team() && !rect.setSize(Core.camera.width * 0.9f, Core.camera.height * 0.9f).setCenter(Core.camera.position.x, Core.camera.position.y).contains(unit.x(), unit.y())){
|
if(!unit.isLocal() && unit.team() != player.team() && !rect.setSize(Core.camera.width * 0.9f, Core.camera.height * 0.9f).setCenter(Core.camera.position.x, Core.camera.position.y).contains(unit.x(), unit.y())){
|
||||||
Tmp.v1.set(unit.x(), unit.y()).sub(Core.camera.position.x, Core.camera.position.y).setLength(indicatorLength);
|
Tmp.v1.set(unit.x(), unit.y()).sub(Core.camera.position.x, Core.camera.position.y).setLength(indicatorLength);
|
||||||
|
|
||||||
Lines.stroke(1f, unit.team().color);
|
Lines.stroke(1f, unit.team().color);
|
||||||
@@ -59,6 +59,8 @@ public class OverlayRenderer{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//mech pads are gone
|
||||||
|
/*
|
||||||
if(ui.hudfrag.blockfrag.currentCategory == Category.upgrade){
|
if(ui.hudfrag.blockfrag.currentCategory == Category.upgrade){
|
||||||
for(Tile mechpad : indexer.getAllied(player.team(), BlockFlag.mechPad)){
|
for(Tile mechpad : indexer.getAllied(player.team(), BlockFlag.mechPad)){
|
||||||
if(!(mechpad.block() instanceof MechPad)) continue;
|
if(!(mechpad.block() instanceof MechPad)) continue;
|
||||||
@@ -72,7 +74,7 @@ public class OverlayRenderer{
|
|||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if(player.dead()) return; //dead players don't draw
|
if(player.dead()) return; //dead players don't draw
|
||||||
@@ -82,7 +84,7 @@ public class OverlayRenderer{
|
|||||||
//draw config selected block
|
//draw config selected block
|
||||||
if(input.frag.config.isShown()){
|
if(input.frag.config.isShown()){
|
||||||
Tile tile = input.frag.config.getSelectedTile();
|
Tile tile = input.frag.config.getSelectedTile();
|
||||||
tile.block().drawConfigure(tile);
|
tile.drawConfigure();
|
||||||
}
|
}
|
||||||
|
|
||||||
input.drawTop();
|
input.drawTop();
|
||||||
@@ -122,7 +124,7 @@ public class OverlayRenderer{
|
|||||||
Tile tile = world.ltileWorld(vec.x, vec.y);
|
Tile tile = world.ltileWorld(vec.x, vec.y);
|
||||||
|
|
||||||
if(tile != null && tile.block() != Blocks.air && tile.team() == player.team()){
|
if(tile != null && tile.block() != Blocks.air && tile.team() == player.team()){
|
||||||
tile.block().drawSelect(tile);
|
tile.drawSelect();
|
||||||
|
|
||||||
if(Core.input.keyDown(Binding.rotateplaced) && tile.block().rotate && tile.interactable(player.team())){
|
if(Core.input.keyDown(Binding.rotateplaced) && tile.block().rotate && tile.interactable(player.team())){
|
||||||
control.input.drawArrow(tile.block(), tile.x, tile.y, tile.rotation(), true);
|
control.input.drawArrow(tile.block(), tile.x, tile.y, tile.rotation(), true);
|
||||||
@@ -143,7 +145,7 @@ public class OverlayRenderer{
|
|||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|
||||||
Tile tile = world.ltileWorld(v.x, v.y);
|
Tile tile = world.ltileWorld(v.x, v.y);
|
||||||
if(tile != null && tile.interactable(player.team()) && tile.block().acceptStack(tile, player.unit().item(), player.unit().stack().amount, player.unit()) > 0){
|
if(tile != null && tile.interactable(player.team()) && tile.acceptStack(player.unit().item(), player.unit().stack().amount, player.unit()) > 0){
|
||||||
Lines.stroke(3f, Pal.gray);
|
Lines.stroke(3f, Pal.gray);
|
||||||
Lines.square(tile.drawx(), tile.drawy(), tile.block().size * tilesize / 2f + 3 + Mathf.absin(Time.time(), 5f, 1f));
|
Lines.square(tile.drawx(), tile.drawy(), tile.block().size * tilesize / 2f + 3 + Mathf.absin(Time.time(), 5f, 1f));
|
||||||
Lines.stroke(1f, Pal.place);
|
Lines.stroke(1f, Pal.place);
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
|
|
||||||
Item item = player.unit().item();
|
Item item = player.unit().item();
|
||||||
int amount = player.unit().stack().amount;
|
int amount = player.unit().stack().amount;
|
||||||
int accepted = tile.block().acceptStack(tile, item, amount, player.unit());
|
int accepted = tile.acceptStack(item, amount, player.unit());
|
||||||
player.unit().stack().amount -= accepted;
|
player.unit().stack().amount -= accepted;
|
||||||
|
|
||||||
int sent = Mathf.clamp(accepted / 4, 1, 8);
|
int sent = Mathf.clamp(accepted / 4, 1, 8);
|
||||||
@@ -145,13 +145,13 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
Core.app.post(() -> Events.fire(new DepositEvent(tile, player, item, accepted)));
|
Core.app.post(() -> Events.fire(new DepositEvent(tile, player, item, accepted)));
|
||||||
|
|
||||||
for(int i = 0; i < sent; i++){
|
for(int i = 0; i < sent; i++){
|
||||||
tile.block().getStackOffset(tile, item, stackTrns);
|
tile.getStackOffset(item, stackTrns);
|
||||||
|
|
||||||
createItemTransfer(item, player.x() + Angles.trnsx(player.unit().rotation() + 180f, backTrns), player.y() + Angles.trnsy(player.unit().rotation() + 180f, backTrns),
|
createItemTransfer(item, player.x() + Angles.trnsx(player.unit().rotation() + 180f, backTrns), player.y() + Angles.trnsy(player.unit().rotation() + 180f, backTrns),
|
||||||
new Vec2(tile.x() + stackTrns.x, tile.y() + stackTrns.y), () -> {
|
new Vec2(tile.x() + stackTrns.x, tile.y() + stackTrns.y), () -> {
|
||||||
if(tile.block() != block || tile.entity == null || tile.items() == null) return;
|
if(tile.block() != block || tile.entity == null || tile.items() == null) return;
|
||||||
|
|
||||||
tile.block().handleStack(tile, item, accepted, player.unit());
|
tile.handleStack(item, accepted, player.unit());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
if(tile == null || player == null) return;
|
if(tile == null || player == null) return;
|
||||||
if(net.server() && (!Units.canInteract(player, tile) ||
|
if(net.server() && (!Units.canInteract(player, tile) ||
|
||||||
!netServer.admins.allowAction(player, ActionType.tapTile, tile, action -> {}))) throw new ValidateException(player, "Player cannot tap a tile.");
|
!netServer.admins.allowAction(player, ActionType.tapTile, tile, action -> {}))) throw new ValidateException(player, "Player cannot tap a tile.");
|
||||||
tile.block().tapped(tile, player);
|
tile.tapped(player);
|
||||||
Core.app.post(() -> Events.fire(new TapEvent(tile, player)));
|
Core.app.post(() -> Events.fire(new TapEvent(tile, player)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
if(tile == null) return;
|
if(tile == null) return;
|
||||||
if(net.server() && (!Units.canInteract(player, tile) ||
|
if(net.server() && (!Units.canInteract(player, tile) ||
|
||||||
!netServer.admins.allowAction(player, ActionType.configure, tile, action -> action.config = value))) throw new ValidateException(player, "Player cannot configure a tile.");
|
!netServer.admins.allowAction(player, ActionType.configure, tile, action -> action.config = value))) throw new ValidateException(player, "Player cannot configure a tile.");
|
||||||
tile.block().configured(tile, player, value);
|
tile.configured(player, value);
|
||||||
Core.app.post(() -> Events.fire(new TapConfigEvent(tile, player, value)));
|
Core.app.post(() -> Events.fire(new TapConfigEvent(tile, player, value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -567,7 +567,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
//check if tapped block is configurable
|
//check if tapped block is configurable
|
||||||
if(tile.block().configurable && tile.interactable(player.team())){
|
if(tile.block().configurable && tile.interactable(player.team())){
|
||||||
consumed = true;
|
consumed = true;
|
||||||
if(((!frag.config.isShown() && tile.block().shouldShowConfigure(tile, player)) //if the config fragment is hidden, show
|
if(((!frag.config.isShown() && tile.shouldShowConfigure(player)) //if the config fragment is hidden, show
|
||||||
//alternatively, the current selected block can 'agree' to switch config tiles
|
//alternatively, the current selected block can 'agree' to switch config tiles
|
||||||
|| (frag.config.isShown() && frag.config.getSelectedTile().block().onConfigureTileTapped(frag.config.getSelectedTile(), tile)))){
|
|| (frag.config.isShown() && frag.config.getSelectedTile().block().onConfigureTileTapped(frag.config.getSelectedTile(), tile)))){
|
||||||
Sounds.click.at(tile);
|
Sounds.click.at(tile);
|
||||||
@@ -750,7 +750,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
|
|
||||||
ItemStack stack = player.unit().stack();
|
ItemStack stack = player.unit().stack();
|
||||||
|
|
||||||
if(tile.block().acceptStack(tile, stack.item, stack.amount, player.unit()) > 0 && tile.interactable(player.team()) && tile.block().hasItems && player.unit().stack().amount > 0 && tile.interactable(player.team())){
|
if(tile.acceptStack(stack.item, stack.amount, player.unit()) > 0 && tile.interactable(player.team()) && tile.block().hasItems && player.unit().stack().amount > 0 && tile.interactable(player.team())){
|
||||||
Call.transferInventory(player, tile);
|
Call.transferInventory(player, tile);
|
||||||
}else{
|
}else{
|
||||||
Call.dropItem(player.angleTo(x, y));
|
Call.dropItem(player.angleTo(x, y));
|
||||||
@@ -1003,7 +1003,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
if(dst(moveTarget) <= 2f * Time.delta()){
|
if(dst(moveTarget) <= 2f * Time.delta()){
|
||||||
if(tapping && !dead()){
|
if(tapping && !dead()){
|
||||||
Tile tile = ((Tilec)moveTarget).tile;
|
Tile tile = ((Tilec)moveTarget).tile;
|
||||||
tile.block().tapped(tile, this);
|
tile.tapped(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
moveTarget = null;
|
moveTarget = null;
|
||||||
|
|||||||
@@ -48,23 +48,23 @@ public class BlockConfigFragment extends Fragment{
|
|||||||
|
|
||||||
table.visible(true);
|
table.visible(true);
|
||||||
table.clear();
|
table.clear();
|
||||||
tile.block().buildConfiguration(tile, table);
|
tile.buildConfiguration(table);
|
||||||
table.pack();
|
table.pack();
|
||||||
table.setTransform(true);
|
table.setTransform(true);
|
||||||
table.actions(Actions.scaleTo(0f, 1f), Actions.visible(true),
|
table.actions(Actions.scaleTo(0f, 1f), Actions.visible(true),
|
||||||
Actions.scaleTo(1f, 1f, 0.07f, Interpolation.pow3Out));
|
Actions.scaleTo(1f, 1f, 0.07f, Interpolation.pow3Out));
|
||||||
|
|
||||||
table.update(() -> {
|
table.update(() -> {
|
||||||
if(configTile != null && configTile.block().shouldHideConfigure(configTile, player)){
|
if(configTile != null && configTile.shouldHideConfigure(player)){
|
||||||
hideConfig();
|
hideConfig();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.setOrigin(Align.center);
|
table.setOrigin(Align.center);
|
||||||
if(configTile == null || configTile.block() == Blocks.air || configTile.block() != configBlock){
|
if(configTile == null || configTile.block() == Blocks.air || !configTile.isValid()){
|
||||||
hideConfig();
|
hideConfig();
|
||||||
}else{
|
}else{
|
||||||
configTile.block().updateTableAlign(tile, table);
|
configTile.updateTableAlign(table);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,12 +41,12 @@ public class BlockInventoryFragment extends Fragment{
|
|||||||
int fa = amount;
|
int fa = amount;
|
||||||
|
|
||||||
if(net.server() && (!Units.canInteract(player, tile) ||
|
if(net.server() && (!Units.canInteract(player, tile) ||
|
||||||
!netServer.admins.allowAction(player, ActionType.withdrawItem, tile.tile(), action -> {
|
!netServer.admins.allowAction(player, ActionType.withdrawItem, tile, action -> {
|
||||||
action.item = item;
|
action.item = item;
|
||||||
action.itemAmount = fa;
|
action.itemAmount = fa;
|
||||||
}))) throw new ValidateException(player, "Player cannot request items.");
|
}))) throw new ValidateException(player, "Player cannot request items.");
|
||||||
|
|
||||||
int removed = tile.block().removeStack(tile, item, amount);
|
int removed = tile.removeStack(item, amount);
|
||||||
|
|
||||||
player.unit().addItem(item, removed);
|
player.unit().addItem(item, removed);
|
||||||
Events.fire(new WithdrawEvent(tile, player, item, amount));
|
Events.fire(new WithdrawEvent(tile, player, item, amount));
|
||||||
@@ -96,7 +96,7 @@ public class BlockInventoryFragment extends Fragment{
|
|||||||
table.touchable(Touchable.enabled);
|
table.touchable(Touchable.enabled);
|
||||||
table.update(() -> {
|
table.update(() -> {
|
||||||
|
|
||||||
if(state.is(State.menu) || tile == null || tile.entity == null || !tile.block().isAccessible() || tile.items().total() == 0){
|
if(state.is(State.menu) || tile == null || !tile.isValid() || !tile.block().isAccessible() || tile.items().total() == 0){
|
||||||
hide();
|
hide();
|
||||||
}else{
|
}else{
|
||||||
if(holding && lastItem != null){
|
if(holding && lastItem != null){
|
||||||
@@ -144,7 +144,7 @@ public class BlockInventoryFragment extends Fragment{
|
|||||||
l.setEnabled(canPick);
|
l.setEnabled(canPick);
|
||||||
|
|
||||||
Element image = itemImage(item.icon(Cicon.xlarge), () -> {
|
Element image = itemImage(item.icon(Cicon.xlarge), () -> {
|
||||||
if(tile == null || tile.entity == null){
|
if(tile == null || !tile.isValid()){
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
return round(tile.items().get(item));
|
return round(tile.items().get(item));
|
||||||
@@ -154,7 +154,7 @@ public class BlockInventoryFragment extends Fragment{
|
|||||||
image.addListener(new InputListener(){
|
image.addListener(new InputListener(){
|
||||||
@Override
|
@Override
|
||||||
public boolean touchDown(InputEvent event, float x, float y, int pointer, KeyCode button){
|
public boolean touchDown(InputEvent event, float x, float y, int pointer, KeyCode button){
|
||||||
if(!canPick.get() || tile == null || tile.entity == null || tile.items() == null || !tile.items().has(item)) return false;
|
if(!canPick.get() || tile == null || !tile.isValid() || tile.items() == null || !tile.items().has(item)) return false;
|
||||||
int amount = Math.min(1, player.unit().maxAccepted(item));
|
int amount = Math.min(1, player.unit().maxAccepted(item));
|
||||||
if(amount > 0){
|
if(amount > 0){
|
||||||
Call.requestItem(player, tile, item, amount);
|
Call.requestItem(player, tile, item, amount);
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public class PlacementFragment extends Fragment{
|
|||||||
scrollPositions.put(currentCategory, blockPane.getScrollY());
|
scrollPositions.put(currentCategory, blockPane.getScrollY());
|
||||||
|
|
||||||
if(Core.input.keyDown(Binding.pick) && player.isBuilder()){ //mouse eyedropper select
|
if(Core.input.keyDown(Binding.pick) && player.isBuilder()){ //mouse eyedropper select
|
||||||
Tile tile = world.ltileWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
|
Tilec tile = world.entWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
|
||||||
Block tryRecipe = tile == null ? null : tile.block();
|
Block tryRecipe = tile == null ? null : tile.block();
|
||||||
|
|
||||||
for(BuildRequest req : player.builder().requests()){
|
for(BuildRequest req : player.builder().requests()){
|
||||||
@@ -341,7 +341,9 @@ public class PlacementFragment extends Fragment{
|
|||||||
topTable.row();
|
topTable.row();
|
||||||
topTable.table(t -> {
|
topTable.table(t -> {
|
||||||
t.left().defaults().left();
|
t.left().defaults().left();
|
||||||
lastDisplay.display(hoverTile, t);
|
if(hoverTile.entity != null){
|
||||||
|
hoverTile.entity.display(t);
|
||||||
|
}
|
||||||
}).left().growX();
|
}).left().growX();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -451,12 +453,7 @@ public class PlacementFragment extends Fragment{
|
|||||||
|
|
||||||
//setup hovering tile
|
//setup hovering tile
|
||||||
if(!Core.scene.hasMouse() && topTable.hit(v.x, v.y, false) == null){
|
if(!Core.scene.hasMouse() && topTable.hit(v.x, v.y, false) == null){
|
||||||
Tile tile = world.tileWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
|
hoverTile = world.tileWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
|
||||||
if(tile != null){
|
|
||||||
hoverTile = tile.link();
|
|
||||||
}else{
|
|
||||||
hoverTile = null;
|
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
hoverTile = null;
|
hoverTile = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -252,6 +252,10 @@ public class Block extends UnlockableContent{
|
|||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TextureRegion getDisplayIcon(Tile tile){
|
||||||
|
return tile.entity == null ? icon(Cicon.medium) : tile.entity.getDisplayIcon();
|
||||||
|
}
|
||||||
|
|
||||||
public String getDisplayName(Tile tile){
|
public String getDisplayName(Tile tile){
|
||||||
return tile.entity == null ? localizedName : tile.entity.getDisplayName();
|
return tile.entity == null ? localizedName : tile.entity.getDisplayName();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public class Build{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(type.isMultiblock()){
|
if(type.isMultiblock()){
|
||||||
if(type.canReplace(tile.block()) && tile.block().size == type.size && type.canPlaceOn(tile) && tile.interactable(team)){
|
if(type.canReplace(tile.block()) && tile.size == type.size && type.canPlaceOn() && tile.interactable(team)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ public class Build{
|
|||||||
&& tile.floor().placeableOn
|
&& tile.floor().placeableOn
|
||||||
&& ((type.canReplace(tile.block())
|
&& ((type.canReplace(tile.block())
|
||||||
&& !(type == tile.block() && rotation == tile.rotation() && type.rotate)) || tile.block().alwaysReplace || tile.block() == Blocks.air)
|
&& !(type == tile.block() && rotation == tile.rotation() && type.rotate)) || tile.block().alwaysReplace || tile.block() == Blocks.air)
|
||||||
&& tile.block().isMultiblock() == type.isMultiblock() && type.canPlaceOn(tile);
|
&& tile.isMultiblock() == type.isMultiblock() && type.canPlaceOn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,6 +150,6 @@ public class Build{
|
|||||||
/** Returns whether the tile at this position is breakable by this team */
|
/** Returns whether the tile at this position is breakable by this team */
|
||||||
public static boolean validBreak(Team team, int x, int y){
|
public static boolean validBreak(Team team, int x, int y){
|
||||||
Tile tile = world.tile(x, y);
|
Tile tile = world.tile(x, y);
|
||||||
return tile != null && tile.block().canBreak(tile) && tile.breakable() && tile.interactable(team);
|
return tile != null && tile.canBreak() && tile.breakable() && tile.interactable(team);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ public class CachedTile extends Tile{
|
|||||||
@Override
|
@Override
|
||||||
protected void preChanged(){
|
protected void preChanged(){
|
||||||
//this basically overrides the old tile code and doesn't remove from proximity
|
//this basically overrides the old tile code and doesn't remove from proximity
|
||||||
team = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ public class ConsumeItems extends Consume{
|
|||||||
@Override
|
@Override
|
||||||
public void build(Tilec tile, Table table){
|
public void build(Tilec tile, Table table){
|
||||||
for(ItemStack stack : items){
|
for(ItemStack stack : items){
|
||||||
table.add(new ReqImage(new ItemImage(stack.item.icon(Cicon.medium), stack.amount), () -> tile.entity != null && tile.entity.items() != null && tile.entity.items().has(stack.item, stack.amount))).size(8 * 4).padRight(5);
|
table.add(new ReqImage(new ItemImage(stack.item.icon(Cicon.medium), stack.amount),
|
||||||
|
() -> tile.items() != null && tile.items().has(stack.item, stack.amount))).size(8 * 4).padRight(5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -439,16 +439,16 @@ public class ApplicationTests{
|
|||||||
|
|
||||||
assertNotNull(tile.entity, "Tile should have an entity, but does not: " + tile);
|
assertNotNull(tile.entity, "Tile should have an entity, but does not: " + tile);
|
||||||
|
|
||||||
int deposited = tile.block().acceptStack(tile, item, capacity - 1, unit);
|
int deposited = tile.acceptStack(item, capacity - 1, unit);
|
||||||
assertEquals(capacity - 1, deposited);
|
assertEquals(capacity - 1, deposited);
|
||||||
|
|
||||||
tile.block().handleStack(tile, item, capacity - 1, unit);
|
tile.handleStack(item, capacity - 1, unit);
|
||||||
assertEquals(tile.entity.items().get(item), capacity - 1);
|
assertEquals(tile.entity.items().get(item), capacity - 1);
|
||||||
|
|
||||||
int overflow = tile.block().acceptStack(tile, item, 10, unit);
|
int overflow = tile.acceptStack(item, 10, unit);
|
||||||
assertEquals(1, overflow);
|
assertEquals(1, overflow);
|
||||||
|
|
||||||
tile.block().handleStack(tile, item, 1, unit);
|
tile.handleStack(item, 1, unit);
|
||||||
assertEquals(capacity, tile.entity.items().get(item));
|
assertEquals(capacity, tile.entity.items().get(item));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user