From 3b08d8c1dd197fd43ae4f6aebbf0c380b511d42f Mon Sep 17 00:00:00 2001 From: Slotterleet <62336673+Slotterleet@users.noreply.github.com> Date: Wed, 25 Sep 2024 12:11:00 +0300 Subject: [PATCH] Surface Detonator chain reactions! --- src/fos/type/blocks/special/SurfaceExplosive.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/fos/type/blocks/special/SurfaceExplosive.java b/src/fos/type/blocks/special/SurfaceExplosive.java index f3085b9..7d78beb 100644 --- a/src/fos/type/blocks/special/SurfaceExplosive.java +++ b/src/fos/type/blocks/special/SurfaceExplosive.java @@ -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 @@ -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())