Sector refactoring, invasions and cleanup
This commit is contained in:
@@ -267,6 +267,10 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
||||
Geometry.circle(x, y, world.width(), world.height(), radius, cons);
|
||||
}
|
||||
|
||||
public void circle(int radius, Cons<Tile> cons){
|
||||
circle(radius, (x, y) -> cons.get(world.rawTile(x, y)));
|
||||
}
|
||||
|
||||
public void recache(){
|
||||
if(!headless && !world.isGenerating()){
|
||||
renderer.blocks.floor.recacheTile(this);
|
||||
@@ -332,6 +336,11 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
||||
recache();
|
||||
}
|
||||
|
||||
/** Sets the overlay without a recache. */
|
||||
public void setOverlayQuiet(Block block){
|
||||
this.overlay = (Floor)block;
|
||||
}
|
||||
|
||||
public void clearOverlay(){
|
||||
setOverlayID((short)0);
|
||||
}
|
||||
|
||||
@@ -121,9 +121,7 @@ public class LaunchPad extends Block{
|
||||
|
||||
return Core.bundle.format("launch.destination",
|
||||
dest == null ? Core.bundle.get("sectors.nonelaunch") :
|
||||
dest.preset == null ?
|
||||
"[accent]Sector " + dest.id :
|
||||
"[accent]" + dest.preset.localizedName);
|
||||
"[accent]" + dest.name());
|
||||
}).pad(4);
|
||||
}
|
||||
|
||||
@@ -213,7 +211,7 @@ public class LaunchPad extends Block{
|
||||
//actually launch the items upon removal
|
||||
if(team() == state.rules.defaultTeam){
|
||||
if(destsec != null && (destsec != state.rules.sector || net.client())){
|
||||
ItemSeq dest = destsec.getExtraItems();
|
||||
ItemSeq dest = new ItemSeq();
|
||||
|
||||
for(ItemStack stack : stacks){
|
||||
dest.add(stack);
|
||||
@@ -223,7 +221,7 @@ public class LaunchPad extends Block{
|
||||
Events.fire(new LaunchItemEvent(stack));
|
||||
}
|
||||
|
||||
destsec.setExtraItems(dest);
|
||||
destsec.addItems(dest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
lastInserted = build.lastInserted;
|
||||
mid = build.mid;
|
||||
minitem = build.minitem;
|
||||
items.addAll(build.items);
|
||||
items.add(build.items);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ public class StackConveyor extends Block implements Autotiler{
|
||||
if(front() instanceof StackConveyorBuild e && e.team == team){
|
||||
// sleep if its occupied
|
||||
if(e.link == -1){
|
||||
e.items.addAll(items);
|
||||
e.items.add(items);
|
||||
e.lastItem = lastItem;
|
||||
e.link = tile.pos();
|
||||
// ▲ to | from ▼
|
||||
|
||||
@@ -70,7 +70,7 @@ public class StorageBlock extends Block{
|
||||
public void overwrote(Seq<Building> previous){
|
||||
for(Building other : previous){
|
||||
if(other.items != null){
|
||||
items.addAll(other.items);
|
||||
items.add(other.items);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -243,6 +243,16 @@ public class ItemModule extends BlockModule{
|
||||
}
|
||||
}
|
||||
|
||||
public void add(ItemSeq stacks){
|
||||
stacks.each(this::add);
|
||||
}
|
||||
|
||||
public void add(ItemModule items){
|
||||
for(int i = 0; i < items.items.length; i++){
|
||||
add(i, items.items[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void add(Item item, int amount){
|
||||
add(item.id, amount);
|
||||
}
|
||||
@@ -261,12 +271,6 @@ public class ItemModule extends BlockModule{
|
||||
}
|
||||
}
|
||||
|
||||
public void addAll(ItemModule items){
|
||||
for(int i = 0; i < items.items.length; i++){
|
||||
add(i, items.items[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(Item item, int amount){
|
||||
amount = Math.min(amount, items[item.id]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user