Bugfixes, cleanup / Created stub processor class
This commit is contained in:
@@ -41,20 +41,6 @@ public class EditorTile extends Tile{
|
|||||||
super.setFloor(type);
|
super.setFloor(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setBlock(Block type){
|
|
||||||
if(state.is(State.playing)){
|
|
||||||
super.setBlock(type);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(block == type) return;
|
|
||||||
op(OpType.block, block.id);
|
|
||||||
if(rotation != 0) op(OpType.rotation, rotation);
|
|
||||||
if(team() != Team.derelict) op(OpType.team, team().id);
|
|
||||||
super.setBlock(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlock(Block type, Team team, int rotation){
|
public void setBlock(Block type, Team team, int rotation){
|
||||||
if(state.is(State.playing)){
|
if(state.is(State.playing)){
|
||||||
@@ -62,9 +48,10 @@ public class EditorTile extends Tile{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setBlock(type);
|
op(OpType.block, block.id);
|
||||||
setTeam(team);
|
if(rotation != 0) op(OpType.rotation, (byte)rotation);
|
||||||
rotation(rotation);
|
if(team() != Team.derelict) op(OpType.team, team().id);
|
||||||
|
super.setBlock(type, team, rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -93,20 +80,15 @@ public class EditorTile extends Tile{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOverlay(Block overlay){
|
public void setOverlay(Block overlay){
|
||||||
setOverlayID(overlay.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setOverlayID(short overlay){
|
|
||||||
if(state.is(State.playing)){
|
if(state.is(State.playing)){
|
||||||
super.setOverlayID(overlay);
|
super.setOverlay(overlay);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(floor.isLiquid) return;
|
if(floor.isLiquid) return;
|
||||||
if(overlayID() == overlay) return;
|
if(overlay() == overlay) return;
|
||||||
op(OpType.overlay, this.overlay.id);
|
op(OpType.overlay, this.overlay.id);
|
||||||
super.setOverlayID(overlay);
|
super.setOverlay(overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -421,10 +421,8 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc{
|
|||||||
for(int i = 0; i < proximity.size; i++){
|
for(int i = 0; i < proximity.size; i++){
|
||||||
incrementDump(proximity.size);
|
incrementDump(proximity.size);
|
||||||
Tilec other = proximity.get((i + dump) % proximity.size);
|
Tilec other = proximity.get((i + dump) % proximity.size);
|
||||||
//TODO fix position
|
if(other.team() == team() && other.acceptItem(this, item) && canDump(other, item)){
|
||||||
Tilec in = Edges.getFacingEdge(tile(), other.tile()).entity;
|
other.handleItem(this, item);
|
||||||
if(other.team() == team() && other.acceptItem(in, item) && canDump(other, item)){
|
|
||||||
other.handleItem(in, item);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -451,24 +449,22 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc{
|
|||||||
|
|
||||||
for(int i = 0; i < proximity.size; i++){
|
for(int i = 0; i < proximity.size; i++){
|
||||||
Tilec other = proximity.get((i + dump) % proximity.size);
|
Tilec other = proximity.get((i + dump) % proximity.size);
|
||||||
//TODO fix position
|
|
||||||
Tilec in = Edges.getFacingEdge(tile, other.tile()).entity;
|
|
||||||
|
|
||||||
if(todump == null){
|
if(todump == null){
|
||||||
|
|
||||||
for(int ii = 0; ii < content.items().size; ii++){
|
for(int ii = 0; ii < content.items().size; ii++){
|
||||||
Item item = content.item(ii);
|
Item item = content.item(ii);
|
||||||
|
|
||||||
if(other.team() == team() && items.has(item) && other.acceptItem(in, item) && canDump(other, item)){
|
if(other.team() == team() && items.has(item) && other.acceptItem(this, item) && canDump(other, item)){
|
||||||
other.handleItem(in, item);
|
other.handleItem(this, item);
|
||||||
items.remove(item, 1);
|
items.remove(item, 1);
|
||||||
incrementDump(proximity.size);
|
incrementDump(proximity.size);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(other.team() == team() && other.acceptItem(in, todump) && canDump(other, todump)){
|
if(other.team() == team() && other.acceptItem(this, todump) && canDump(other, todump)){
|
||||||
other.handleItem(in, todump);
|
other.handleItem(this, todump);
|
||||||
items.remove(todump, 1);
|
items.remove(todump, 1);
|
||||||
incrementDump(proximity.size);
|
incrementDump(proximity.size);
|
||||||
return true;
|
return true;
|
||||||
@@ -798,10 +794,10 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when another tile is tapped while this block is selected.
|
* Called when another tile is tapped while this block is selected.
|
||||||
* Returns whether or not this block should be deselected.
|
* @return whether or not this block should be deselected.
|
||||||
*/
|
*/
|
||||||
public boolean onConfigureTileTapped(Tilec other){
|
public boolean onConfigureTileTapped(Tilec other){
|
||||||
return tile != other;
|
return this != other;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns whether this config menu should show when the specified player taps it. */
|
/** Returns whether this config menu should show when the specified player taps it. */
|
||||||
|
|||||||
@@ -570,6 +570,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
boolean tileTapped(@Nullable Tilec tile){
|
boolean tileTapped(@Nullable Tilec tile){
|
||||||
if(tile == null){
|
if(tile == null){
|
||||||
frag.inv.hide();
|
frag.inv.hide();
|
||||||
|
frag.config.hideConfig();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean consumed = false, showedInventory = false;
|
boolean consumed = false, showedInventory = false;
|
||||||
|
|||||||
@@ -497,6 +497,10 @@ public class Tile implements Position{
|
|||||||
other.entity = null;
|
other.entity = null;
|
||||||
}
|
}
|
||||||
other.block = Blocks.air;
|
other.block = Blocks.air;
|
||||||
|
|
||||||
|
//manually call changed event
|
||||||
|
other.updateOcclusion();
|
||||||
|
world.notifyChanged(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ public class BurstTurret extends ItemTurret{
|
|||||||
|
|
||||||
for(int i = 0; i < shots; i++){
|
for(int i = 0; i < shots; i++){
|
||||||
Time.run(burstSpacing * i, () -> {
|
Time.run(burstSpacing * i, () -> {
|
||||||
if(!(tile.entity instanceof TurretEntity) ||
|
if(!(tile.entity instanceof TurretEntity) || !hasAmmo()) return;
|
||||||
!hasAmmo()) return;
|
|
||||||
|
|
||||||
recoil = recoilAmount;
|
recoil = recoilAmount;
|
||||||
|
|
||||||
|
|||||||
37
core/src/mindustry/world/blocks/logic/ProcessorBlock.java
Normal file
37
core/src/mindustry/world/blocks/logic/ProcessorBlock.java
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
package mindustry.world.blocks.logic;
|
||||||
|
|
||||||
|
import arc.scene.ui.layout.*;
|
||||||
|
import arc.struct.*;
|
||||||
|
import mindustry.gen.*;
|
||||||
|
import mindustry.world.*;
|
||||||
|
|
||||||
|
public class ProcessorBlock extends Block{
|
||||||
|
|
||||||
|
public ProcessorBlock(String name){
|
||||||
|
super(name);
|
||||||
|
configurable = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ProcessorEntity extends TileEntity{
|
||||||
|
//all tiles in the block network - does not include itself
|
||||||
|
Array<Tilec> network = new Array<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onConfigureTileTapped(Tilec other){
|
||||||
|
if(other == this) return true;
|
||||||
|
|
||||||
|
if(!network.contains(other)){
|
||||||
|
network.add(other);
|
||||||
|
}else{
|
||||||
|
network.remove(other);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildConfiguration(Table table){
|
||||||
|
super.buildConfiguration(table);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user