Fixed RailBulletType effect length
This commit is contained in:
@@ -7,6 +7,9 @@ import mindustry.entities.*;
|
|||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
|
||||||
public class RailBulletType extends BulletType{
|
public class RailBulletType extends BulletType{
|
||||||
|
//for calculating the furthest point
|
||||||
|
static float furthest = 0;
|
||||||
|
|
||||||
public Effect pierceEffect = Fx.hitBulletSmall, updateEffect = Fx.none;
|
public Effect pierceEffect = Fx.hitBulletSmall, updateEffect = Fx.none;
|
||||||
/** Multiplier of damage decreased per health pierced. */
|
/** Multiplier of damage decreased per health pierced. */
|
||||||
public float pierceDamageFactor = 1f;
|
public float pierceDamageFactor = 1f;
|
||||||
@@ -47,6 +50,11 @@ public class RailBulletType extends BulletType{
|
|||||||
|
|
||||||
//subtract health from each consecutive pierce
|
//subtract health from each consecutive pierce
|
||||||
b.damage -= Math.min(b.damage, sub);
|
b.damage -= Math.min(b.damage, sub);
|
||||||
|
|
||||||
|
//bullet was stopped, decrease furthest distance
|
||||||
|
if(b.damage <= 0f){
|
||||||
|
furthest = Math.min(furthest, b.dst(pos));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -54,8 +62,9 @@ public class RailBulletType extends BulletType{
|
|||||||
super.init(b);
|
super.init(b);
|
||||||
|
|
||||||
b.fdata = length;
|
b.fdata = length;
|
||||||
|
furthest = length;
|
||||||
Damage.collideLine(b, b.team, b.type.hitEffect, b.x, b.y, b.rotation(), length, false, false);
|
Damage.collideLine(b, b.team, b.type.hitEffect, b.x, b.y, b.rotation(), length, false, false);
|
||||||
float resultLen = b.fdata;
|
float resultLen = furthest;
|
||||||
|
|
||||||
Vec2 nor = Tmp.v1.trns(b.rotation(), 1f).nor();
|
Vec2 nor = Tmp.v1.trns(b.rotation(), 1f).nor();
|
||||||
for(float i = 0; i <= resultLen; i += updateEffectSeg){
|
for(float i = 0; i <= resultLen; i += updateEffectSeg){
|
||||||
|
|||||||
+1
-1
@@ -11,4 +11,4 @@ android.useAndroidX=true
|
|||||||
#used for slow jitpack builds; TODO see if this actually works
|
#used for slow jitpack builds; TODO see if this actually works
|
||||||
http.socketTimeout=80000
|
http.socketTimeout=80000
|
||||||
http.connectionTimeout=80000
|
http.connectionTimeout=80000
|
||||||
archash=2fff3e0fc21546b1a52652c8222faf78847b6991
|
archash=83ba08c732333d88d7f46142721cec043d6bbeee
|
||||||
|
|||||||
Reference in New Issue
Block a user