From 16b9d6877337041e133e43170180c4ca334c1077 Mon Sep 17 00:00:00 2001 From: "Matthew (or Maya) Peng" <54301439+MEEPofFaith@users.noreply.github.com> Date: Thu, 3 Feb 2022 06:48:44 -0800 Subject: [PATCH] Option to not hardcode a bullet's `status` and `despawnHit` (#6553) * Make not being hardcoded an option * No one is gonna set a negative light radius, but just in case... --- .../mindustry/entities/bullet/BulletType.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index 8836c6b5cd..4e0dd7572c 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -120,6 +120,9 @@ public class BulletType extends Content implements Cloneable{ public boolean despawnHit = false; //additional effects + + /** Whether status and despawnHit should automatically be set. */ + public boolean setDefaults = true; public float fragCone = 360f; public float fragAngle = 0f; @@ -405,9 +408,15 @@ public class BulletType extends Content implements Cloneable{ //pierceBuilding is not enabled by default, because a bullet may want to *not* pierce buildings } - if(lightning > 0){ - if(status == StatusEffects.none){ - status = StatusEffects.shocked; + if(setDefaults){ + if(lightning > 0){ + if(status == StatusEffects.none){ + status = StatusEffects.shocked; + } + } + + if(fragBullet != null || splashDamageRadius > 0 || lightning > 0){ + despawnHit = true; } } @@ -415,13 +424,10 @@ public class BulletType extends Content implements Cloneable{ lightningType = !collidesAir ? Bullets.damageLightningGround : Bullets.damageLightning; } - if(fragBullet != null || splashDamageRadius > 0 || lightning > 0){ - despawnHit = true; - } - - if(lightRadius == -1){ + if(lightRadius <= -1){ lightRadius = Math.max(18, hitSize * 5f); } + drawSize = Math.max(drawSize, trailLength * speed * 2f); }