Skip to content

Commit

Permalink
Surface Detonator chain reactions!
Browse files Browse the repository at this point in the history
  • Loading branch information
Slotterleet committed Sep 25, 2024
1 parent b371c32 commit 3b08d8c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/fos/type/blocks/special/SurfaceExplosive.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ public void updateTile() {

if (canConsume())
counter -= Time.delta;
else
counter = 180f;
}

@Override
public void onDestroyed() {
super.onDestroyed();

if (canConsume())
detonate();
}

// hard-coded for now
Expand All @@ -103,7 +113,10 @@ public void detonate() {
// pre-detonation init
tileOn().circle(range, t -> {
if (t == null || bannedFloors.contains(t.floor()) ||
(t.block() != air && t.block() != this.block && t.block() != cliff)) return;
((t.block() != air && t.build == null) && t.block() != this.block && t.block() != cliff)) return;

// first destroy buildings!
if (t.build != null && t.build != this) t.build.kill();

tiles.add(t);
if (t.floor() != deepFloor())
Expand Down

0 comments on commit 3b08d8c

Please sign in to comment.