Implemented #3486 with some minor changes
This commit is contained in:
@@ -377,7 +377,8 @@ public class Block extends UnlockableContent{
|
||||
|
||||
public boolean canReplace(Block other){
|
||||
if(other.alwaysReplace) return true;
|
||||
return (other != this || rotate) && this.group != BlockGroup.none && other.group == this.group && (size == other.size || (size >= other.size && subclass != null && subclass == other.subclass));
|
||||
return (other != this || rotate) && this.group != BlockGroup.none && other.group == this.group &&
|
||||
(size == other.size || (size >= other.size && ((subclass != null && subclass == other.subclass) || group.anyReplace)));
|
||||
}
|
||||
|
||||
/** @return a possible replacement for this block when placed in a line by the player. */
|
||||
|
||||
@@ -69,12 +69,6 @@ public class Wall extends Block{
|
||||
return new TextureRegion[]{Core.atlas.find(Core.atlas.has(name) ? name : name + "1")};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReplace(Block other){
|
||||
if(other.alwaysReplace) return true;
|
||||
return (other != this || rotate) && this.group != BlockGroup.none && other.group == this.group && other != this && size >= other.size;
|
||||
}
|
||||
|
||||
public class WallBuild extends Building{
|
||||
public float hit;
|
||||
|
||||
|
||||
@@ -23,12 +23,6 @@ public class Router extends Block{
|
||||
noUpdateDisabled = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReplace(Block other){
|
||||
if(other.alwaysReplace) return true;
|
||||
return (other != this || rotate) && this.group != BlockGroup.none && other.group == this.group && size >= other.size;
|
||||
}
|
||||
|
||||
public class RouterBuild extends Building implements ControlBlock{
|
||||
public Item lastItem;
|
||||
public Tile lastInput;
|
||||
|
||||
@@ -254,7 +254,7 @@ public class CoreBlock extends StorageBlock{
|
||||
|
||||
for(Building other : state.teams.cores(team)){
|
||||
if(other.tile() == tile) continue;
|
||||
storageCapacity += other.block.itemCapacity + other.proximity().sum(e -> owns(e) && owns(other, e) ? e.block.itemCapacity : 0);
|
||||
storageCapacity += other.block.itemCapacity + other.proximity().sum(e -> owns(other, e) ? e.block.itemCapacity : 0);
|
||||
}
|
||||
|
||||
//Team.sharded.core().items.set(Items.surgeAlloy, 12000)
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
package mindustry.world.meta;
|
||||
|
||||
public enum BlockGroup{
|
||||
none, walls, projectors, turrets, transportation, power, liquids, drills, storage, units, logic
|
||||
none, walls(true), projectors(true), turrets, transportation(true), power, liquids(true), drills, storage, units, logic(true);
|
||||
|
||||
/** if true, any block in this category replaces any other block in this category. */
|
||||
public final boolean anyReplace;
|
||||
|
||||
BlockGroup(boolean anyReplace){
|
||||
this.anyReplace = anyReplace;
|
||||
}
|
||||
|
||||
BlockGroup(){
|
||||
this(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user