Proper trails for point lasers (#8038)
* Proper trails for point lasers * Take current size into account * fh9weqfjpoepiofjwpiqoefjpoiwjieqpofpjioji * Web editing moment * Point laser bullets shouldn't have aa shoot effect * h
This commit is contained in:
@@ -10,6 +10,8 @@ import mindustry.entities.*;
|
|||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
|
|
||||||
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
/** A continuous bullet type that only damages in a point. */
|
/** A continuous bullet type that only damages in a point. */
|
||||||
public class PointLaserBulletType extends BulletType{
|
public class PointLaserBulletType extends BulletType{
|
||||||
public String sprite = "point-laser";
|
public String sprite = "point-laser";
|
||||||
@@ -29,7 +31,6 @@ public class PointLaserBulletType extends BulletType{
|
|||||||
removeAfterPierce = false;
|
removeAfterPierce = false;
|
||||||
speed = 0f;
|
speed = 0f;
|
||||||
despawnEffect = Fx.none;
|
despawnEffect = Fx.none;
|
||||||
shootEffect = Fx.none;
|
|
||||||
lifetime = 20f;
|
lifetime = 20f;
|
||||||
impact = true;
|
impact = true;
|
||||||
keepVelocity = false;
|
keepVelocity = false;
|
||||||
@@ -38,6 +39,7 @@ public class PointLaserBulletType extends BulletType{
|
|||||||
hittable = false;
|
hittable = false;
|
||||||
absorbable = false;
|
absorbable = false;
|
||||||
optimalLifeFract = 0.5f;
|
optimalLifeFract = 0.5f;
|
||||||
|
shootEffect = smokeEffect = Fx.none;
|
||||||
|
|
||||||
//just make it massive, users of this bullet can adjust as necessary
|
//just make it massive, users of this bullet can adjust as necessary
|
||||||
drawSize = 1000f;
|
drawSize = 1000f;
|
||||||
@@ -82,4 +84,30 @@ public class PointLaserBulletType extends BulletType{
|
|||||||
Effect.shake(shake, shake, b);
|
Effect.shake(shake, shake, b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTrailEffects(Bullet b){
|
||||||
|
if(trailChance > 0){
|
||||||
|
if(Mathf.chanceDelta(trailChance)){
|
||||||
|
trailEffect.at(b.aimX, b.aimY, trailRotation ? b.angleTo(b.aimX, b.aimY) : (trailParam * b.fslope()), trailColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(trailInterval > 0f){
|
||||||
|
if(b.timer(0, trailInterval)){
|
||||||
|
trailEffect.at(b.aimX, b.aimY, trailRotation ? b.angleTo(b.aimX, b.aimY) : (trailParam * b.fslope()), trailColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTrail(Bullet b){
|
||||||
|
if(!headless && trailLength > 0){
|
||||||
|
if(b.trail == null){
|
||||||
|
b.trail = new Trail(trailLength);
|
||||||
|
}
|
||||||
|
b.trail.length = trailLength;
|
||||||
|
b.trail.update(b.aimX, b.aimY, b.fslope() * (1f - (trailSinMag > 0 ? Mathf.absin(Time.time, trailSinScl, trailSinMag) : 0f)));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user