mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-03-19 05:12:28 -07:00
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:
parent
2c3210afce
commit
7455fb21a4
1 changed files with 29 additions and 1 deletions
|
|
@ -10,6 +10,8 @@ import mindustry.entities.*;
|
|||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
/** A continuous bullet type that only damages in a point. */
|
||||
public class PointLaserBulletType extends BulletType{
|
||||
public String sprite = "point-laser";
|
||||
|
|
@ -29,7 +31,6 @@ public class PointLaserBulletType extends BulletType{
|
|||
removeAfterPierce = false;
|
||||
speed = 0f;
|
||||
despawnEffect = Fx.none;
|
||||
shootEffect = Fx.none;
|
||||
lifetime = 20f;
|
||||
impact = true;
|
||||
keepVelocity = false;
|
||||
|
|
@ -38,6 +39,7 @@ public class PointLaserBulletType extends BulletType{
|
|||
hittable = false;
|
||||
absorbable = false;
|
||||
optimalLifeFract = 0.5f;
|
||||
shootEffect = smokeEffect = Fx.none;
|
||||
|
||||
//just make it massive, users of this bullet can adjust as necessary
|
||||
drawSize = 1000f;
|
||||
|
|
@ -82,4 +84,30 @@ public class PointLaserBulletType extends BulletType{
|
|||
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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue