mirror of
https://github.com/Anuken/Mindustry.git
synced 2024-12-22 21:04:14 +07:00
Fixed #10010
This commit is contained in:
parent
d8dc9c7c98
commit
07738cbac6
@ -47,17 +47,7 @@ public class Logic implements ApplicationListener{
|
||||
|
||||
Events.on(BlockBuildEndEvent.class, event -> {
|
||||
if(!event.breaking){
|
||||
TeamData data = event.team.data();
|
||||
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();
|
||||
}
|
||||
}
|
||||
checkOverlappingPlans(event.team, event.tile);
|
||||
|
||||
if(event.team == state.rules.defaultTeam){
|
||||
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
|
||||
Events.on(SaveLoadEvent.class, e -> {
|
||||
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. */
|
||||
public void play(){
|
||||
state.set(State.playing);
|
||||
|
Loading…
Reference in New Issue
Block a user