From 1b14a09f1c9c3d39a22f87dd153d9df5b6598eb0 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Sat, 27 Jan 2024 18:24:48 -0800 Subject: [PATCH 1/2] Shield health should also be factored in pierce factor when maxDamageFraction is 0 (#9486) --- core/src/mindustry/entities/bullet/BulletType.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index 4ab4c929a4..2870715f06 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -387,14 +387,14 @@ public class BulletType extends Content implements Cloneable{ if(entity instanceof Healthc h){ float damage = b.damage; + float shield = entity instanceof Shieldc s ? Math.max(s.shield(), 0f) : 0f; if(maxDamageFraction > 0){ - float cap = h.maxHealth() * maxDamageFraction; - if(entity instanceof Shieldc s){ - cap += Math.max(s.shield(), 0f); - } + float cap = h.maxHealth() * maxDamageFraction + shield; damage = Math.min(damage, cap); //cap health to effective health for handlePierce to handle it properly health = Math.min(health, cap); + }else{ + health += shield; } if(pierceArmor){ h.damagePierce(damage); From 6db4ef7f1c428021c1df8f5efffb0796add7589f Mon Sep 17 00:00:00 2001 From: Sh1p*nfire <73347888+Sh1penfire@users.noreply.github.com> Date: Mon, 29 Jan 2024 05:04:21 +1100 Subject: [PATCH 2/2] PartProgress.time & PartProgress.mod added (#9499) * PartProgress.time & PartProgress.mod added * Add loop() to combine mul and mod --- core/src/mindustry/entities/part/DrawPart.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/entities/part/DrawPart.java b/core/src/mindustry/entities/part/DrawPart.java index f3ebfc6ceb..a8642fe6d4 100644 --- a/core/src/mindustry/entities/part/DrawPart.java +++ b/core/src/mindustry/entities/part/DrawPart.java @@ -85,8 +85,10 @@ public abstract class DrawPart{ /** Weapon heat, 1 when just fired, 0, when it has cooled down (duration depends on weapon) */ heat = p -> p.heat, /** Lifetime fraction, 0 to 1. Only for missiles. */ - life = p -> p.life; - + life = p -> p.life, + /** Current unscaled value of Time.time. */ + time = p -> Time.time; + float get(PartParams p); static PartProgress constant(float value){ @@ -167,6 +169,14 @@ public abstract class DrawPart{ default PartProgress absin(float scl, float mag){ return p -> get(p) + Mathf.absin(scl, mag); } + + default PartProgress mod(float amount){ + return p -> Mathf.mod(get(p), amount); + } + + default PartProgress loop(float time){ + return p -> Mathf.mod(get(p)/time, 1); + } default PartProgress apply(PartProgress other, PartFunc func){ return p -> func.get(get(p), other.get(p));