From 0eb0f349089e8457c64313453a49342d301f5688 Mon Sep 17 00:00:00 2001 From: Leonwang4234 <62972692+Leonwang4234@users.noreply.github.com> Date: Thu, 8 Oct 2020 19:14:05 -0700 Subject: [PATCH] add pierceCap --- core/src/mindustry/entities/bullet/BulletType.java | 6 ++++++ core/src/mindustry/entities/comp/BulletComp.java | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index ee7278fa6a..177c7c5f9f 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -25,6 +25,7 @@ public abstract class BulletType extends Content{ public float drawSize = 40f; public float drag = 0f; public boolean pierce, pierceBuilding; + public int pierceCap = 1; public Effect hitEffect, despawnEffect; /** Effect created when shooting. */ @@ -235,6 +236,11 @@ public abstract class BulletType extends Content{ } public void init(Bullet b){ + if(pierceCap > 1) { + pierce = true; + /** pierceBuilding = true; should this be true or not? */ + } + if(killShooter && b.owner() instanceof Healthc){ ((Healthc)b.owner()).kill(); } diff --git a/core/src/mindustry/entities/comp/BulletComp.java b/core/src/mindustry/entities/comp/BulletComp.java index ac831ef507..a2a584a063 100644 --- a/core/src/mindustry/entities/comp/BulletComp.java +++ b/core/src/mindustry/entities/comp/BulletComp.java @@ -144,6 +144,10 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw return false; }); } + + if(collided.size >= type.pierceCap) { + remove(); + } } @Override