Fixed #10010
This commit is contained in:
@@ -47,17 +47,7 @@ public class Logic implements ApplicationListener{
|
|||||||
|
|
||||||
Events.on(BlockBuildEndEvent.class, event -> {
|
Events.on(BlockBuildEndEvent.class, event -> {
|
||||||
if(!event.breaking){
|
if(!event.breaking){
|
||||||
TeamData data = event.team.data();
|
checkOverlappingPlans(event.team, event.tile);
|
||||||
Iterator<BlockPlan> it = data.plans.iterator();
|
|
||||||
var bounds = event.tile.block().bounds(event.tile.x, event.tile.y, Tmp.r1);
|
|
||||||
while(it.hasNext()){
|
|
||||||
BlockPlan b = it.next();
|
|
||||||
Block block = content.block(b.block);
|
|
||||||
if(bounds.overlaps(block.bounds(b.x, b.y, Tmp.r2))){
|
|
||||||
b.removed = true;
|
|
||||||
it.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(event.team == state.rules.defaultTeam){
|
if(event.team == state.rules.defaultTeam){
|
||||||
state.stats.placedBlockCount.increment(event.tile.block());
|
state.stats.placedBlockCount.increment(event.tile.block());
|
||||||
@@ -65,6 +55,12 @@ public class Logic implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Events.on(PayloadDropEvent.class, e -> {
|
||||||
|
if(e.build != null){
|
||||||
|
checkOverlappingPlans(e.build.team, e.build.tile);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//when loading a 'damaged' sector, propagate the damage
|
//when loading a 'damaged' sector, propagate the damage
|
||||||
Events.on(SaveLoadEvent.class, e -> {
|
Events.on(SaveLoadEvent.class, e -> {
|
||||||
if(state.isCampaign()){
|
if(state.isCampaign()){
|
||||||
@@ -211,6 +207,20 @@ public class Logic implements ApplicationListener{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkOverlappingPlans(Team team, Tile tile){
|
||||||
|
TeamData data = team.data();
|
||||||
|
Iterator<BlockPlan> it = data.plans.iterator();
|
||||||
|
var bounds = tile.block().bounds(tile.x, tile.y, Tmp.r1);
|
||||||
|
while(it.hasNext()){
|
||||||
|
BlockPlan b = it.next();
|
||||||
|
Block block = content.block(b.block);
|
||||||
|
if(bounds.overlaps(block.bounds(b.x, b.y, Tmp.r2))){
|
||||||
|
b.removed = true;
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Adds starting items, resets wave time, and sets state to playing. */
|
/** Adds starting items, resets wave time, and sets state to playing. */
|
||||||
public void play(){
|
public void play(){
|
||||||
state.set(State.playing);
|
state.set(State.playing);
|
||||||
|
|||||||
Reference in New Issue
Block a user