From 1c4e6b77b472953e8f2ac4a97c7974c8a43de3e5 Mon Sep 17 00:00:00 2001 From: MrDuck557 <48808663+MrDuck557@users.noreply.github.com> Date: Tue, 9 Nov 2021 18:10:28 -0500 Subject: [PATCH] DestroyBullet (#6311) * DestroyBullet * one space * review Co-authored-by: Lele567 <48808663+Lele567@users.noreply.github.com> --- core/src/mindustry/entities/comp/BuildingComp.java | 7 ++++++- core/src/mindustry/world/Block.java | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index 92014d9829..26dc1284e1 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -1035,7 +1035,12 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, /** Called *after* the tile has been removed. */ public void afterDestroyed(){ - + if(block.destroyBullet != null){ + //I really do not like that the bullet will not destroy derelict + //but I can't do anything about it without using a random team + //which may or may not cause issues with servers and js + block.destroyBullet.create(this, Team.derelict, x, y, 0); + } } /** @return the cap for item amount calculations, used when this block explodes. */ diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index f75d256bef..1f1dce4ddd 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -29,6 +29,7 @@ import mindustry.world.blocks.*; import mindustry.world.blocks.environment.*; import mindustry.world.blocks.power.*; import mindustry.world.consumers.*; +import mindustry.entities.bullet.*; import mindustry.world.meta.*; import java.lang.reflect.*; @@ -132,6 +133,8 @@ public class Block extends UnlockableContent{ public int health = -1; /** base block explosiveness */ public float baseExplosiveness = 0f; + /** bullet that this block spawns when destroyed */ + public @Nullable BulletType destroyBullet = null; /** whether this block can be placed on edges of liquids. */ public boolean floating = false; /** multiblock size */