Bugfixes / Removed tile unit multi-mining

This commit is contained in:
Anuken
2020-10-25 11:22:10 -04:00
parent b2b0082c7d
commit 81dae580a4
23 changed files with 111 additions and 57 deletions
+4 -1
View File
@@ -126,7 +126,6 @@ public class Build{
for(int dy = 0; dy < type.size; dy++){
int wx = dx + offsetx + tile.x, wy = dy + offsety + tile.y;
Tile check = world.tile(wx, wy);
if(
@@ -136,6 +135,10 @@ public class Build{
!check.interactable(team) || //cannot interact
!check.floor().placeableOn || //solid wall
!((type.canReplace(check.block()) || //can replace type
//controversial change: allow rebuilding damaged blocks
//this could be buggy and abusable, so I'm not enabling it yet
//note that this requires a change in BuilderComp as well
//(type == check.block() && check.centerX() == x && check.centerY() == y && check.build != null && check.build.health < check.build.maxHealth - 0.0001f) ||
(check.block instanceof ConstructBlock && check.<ConstructBuild>bc().cblock == type && check.centerX() == tile.x && check.centerY() == tile.y)) && //same type in construction
type.bounds(tile.x, tile.y, Tmp.r1).grow(0.01f).contains(check.block.bounds(check.centerX(), check.centerY(), Tmp.r2))) || //no replacement
(type.requiresWater && check.floor().liquidDrop != Liquids.water) //requires water but none found
@@ -119,7 +119,7 @@ public class LaunchPad extends Block{
table.row();
table.label(() -> {
Sector dest = state.secinfo.getRealDestination();
Sector dest = state.rules.sector == null ? null : state.rules.sector.info.getRealDestination();
return Core.bundle.format("launch.destination",
dest == null ? Core.bundle.get("sectors.nonelaunch") :
@@ -135,7 +135,11 @@ public class LaunchPad extends Block{
}
table.button(Icon.upOpen, Styles.clearTransi, () -> {
ui.planet.showSelect(state.rules.sector, other -> state.secinfo.destination = other);
ui.planet.showSelect(state.rules.sector, other -> {
if(state.isCampaign()){
state.rules.sector.info.destination = other;
}
});
deselect();
}).size(40f);
}
@@ -208,7 +212,7 @@ public class LaunchPad extends Block{
public void remove(){
if(!state.isCampaign()) return;
Sector destsec = state.secinfo.getRealDestination();
Sector destsec = state.rules.sector.info.getRealDestination();
//actually launch the items upon removal
if(team() == state.rules.defaultTeam){
@@ -219,7 +223,7 @@ public class LaunchPad extends Block{
dest.add(stack);
//update export
state.secinfo.handleItemExport(stack);
state.rules.sector.info.handleItemExport(stack);
Events.fire(new LaunchItemEvent(stack));
}
@@ -339,15 +339,15 @@ public class CoreBlock extends StorageBlock{
public void itemTaken(Item item){
if(state.isCampaign() && team == state.rules.defaultTeam){
//update item taken amount
state.secinfo.handleCoreItem(item, -1);
state.rules.sector.info.handleCoreItem(item, -1);
}
}
@Override
public void handleItem(Building source, Item item){
if(net.server() || !net.active()){
if(team == state.rules.defaultTeam){
state.secinfo.handleCoreItem(item, 1);
if(team == state.rules.defaultTeam && state.isCampaign()){
state.rules.sector.info.handleCoreItem(item, 1);
}
if(items.get(item) >= getMaximumAccepted(item)){