Skip to content

Commit

Permalink
Add back bullet absorption
Browse files Browse the repository at this point in the history
  • Loading branch information
MEEPofFaith committed Mar 5, 2024
1 parent ea72929 commit 96255d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 41 deletions.
24 changes: 1 addition & 23 deletions src/progressed/content/bullets/PMBullets.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class PMBullets{

pillarField,

blackHole, absorbed,
blackHole,

excaliburLaser, sentinelLaser,

Expand Down Expand Up @@ -113,28 +113,6 @@ public static void load(){
chargeEffect = EnergyFx.kugelblitzGrow;
}};

absorbed = new BulletType(0f, 0f){
@Override
public void despawned(Bullet b){
//Do nothing
}

@Override
public void hit(Bullet b, float x, float y){
//Do nothing
}

@Override
public void hitTile(Bullet b, Building build, float x, float y, float initialHealth, boolean direct){
//do nothing
}

@Override
public void update(Bullet b){
//Do nothing
}
};

excaliburLaser = new CrossLaserBulletType(1500f){{
length = 800f;
width = 26f;
Expand Down
27 changes: 9 additions & 18 deletions src/progressed/entities/bullet/energy/BlackHoleBulletType.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
import mindustry.entities.bullet.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import progressed.content.bullets.*;
import progressed.content.effects.*;
import progressed.entities.*;
import progressed.entities.bullet.pseudo3d.*;
import progressed.graphics.renders.*;
import progressed.graphics.trails.*;

public class BlackHoleBulletType extends BulletType{
static Seq<Class<?>> immuneTypes = Seq.with(
Expand All @@ -32,6 +30,7 @@ public class BlackHoleBulletType extends BulletType{
public Effect absorbEffect = EnergyFx.blackHoleAbsorb, swirlEffect = EnergyFx.blackHoleSwirl;
public float suctionRadius = 160f, size = 6f, lensEdge = -1f, damageRadius = 17f;
public float force = 10f, scaledForce = 800f, bulletForce = 0.1f, bulletScaledForce = 1f;
public float bulletDamage = 10f;
public float swirlInterval = 3f;
public int swirlEffects = 4;
public boolean repel;
Expand Down Expand Up @@ -85,9 +84,14 @@ public void update(Bullet b){
other.move(impulse.x, impulse.y);
}

/*if(Mathf.within(b.x, b.y, other.x, other.y, size * 2f)){
absorbBullet(other);
}*/
if(other.type.hittable && Mathf.within(b.x, b.y, other.x, other.y, size * 2f)){
float realDamage = bulletDamage * damageMultiplier(b);
if(other.damage > realDamage){
other.damage(other.damage - realDamage);
}else{
other.remove();
}
}
}
});
}
Expand Down Expand Up @@ -137,19 +141,6 @@ public void despawned(Bullet b){
}
}

public void absorbBullet(Bullet bullet){
if(absorbEffect != Fx.none) absorbEffect.at(bullet.x, bullet.y);
if(bullet.type.trailLength > 0 && bullet.trail != null && bullet.trail.size() > 0){
if(bullet.trail instanceof PMTrail t){
TrailFadeFx.PMTrailFade.at(bullet.x, bullet.y, bullet.type.trailWidth, bullet.type.trailColor, t.copyPM());
}else{
Fx.trailFade.at(bullet.x, bullet.y, bullet.type.trailWidth, bullet.type.trailColor, bullet.trail.copy());
}
}
bullet.type = PMBullets.absorbed;
bullet.absorb();
}

public static boolean checkType(BulletType type){ //Returns true for bullets immune to suction.
return immuneTypes.contains(c -> c.isAssignableFrom(type.getClass()));
}
Expand Down

0 comments on commit 96255d4

Please sign in to comment.