Skip to content

Commit 96255d4

Browse files
committed
Add back bullet absorption
1 parent ea72929 commit 96255d4

File tree

2 files changed

+10
-41
lines changed

2 files changed

+10
-41
lines changed

src/progressed/content/bullets/PMBullets.java

+1-23
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class PMBullets{
2525

2626
pillarField,
2727

28-
blackHole, absorbed,
28+
blackHole,
2929

3030
excaliburLaser, sentinelLaser,
3131

@@ -113,28 +113,6 @@ public static void load(){
113113
chargeEffect = EnergyFx.kugelblitzGrow;
114114
}};
115115

116-
absorbed = new BulletType(0f, 0f){
117-
@Override
118-
public void despawned(Bullet b){
119-
//Do nothing
120-
}
121-
122-
@Override
123-
public void hit(Bullet b, float x, float y){
124-
//Do nothing
125-
}
126-
127-
@Override
128-
public void hitTile(Bullet b, Building build, float x, float y, float initialHealth, boolean direct){
129-
//do nothing
130-
}
131-
132-
@Override
133-
public void update(Bullet b){
134-
//Do nothing
135-
}
136-
};
137-
138116
excaliburLaser = new CrossLaserBulletType(1500f){{
139117
length = 800f;
140118
width = 26f;

src/progressed/entities/bullet/energy/BlackHoleBulletType.java

+9-18
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
import mindustry.entities.bullet.*;
1111
import mindustry.gen.*;
1212
import mindustry.graphics.*;
13-
import progressed.content.bullets.*;
1413
import progressed.content.effects.*;
1514
import progressed.entities.*;
1615
import progressed.entities.bullet.pseudo3d.*;
1716
import progressed.graphics.renders.*;
18-
import progressed.graphics.trails.*;
1917

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

88-
/*if(Mathf.within(b.x, b.y, other.x, other.y, size * 2f)){
89-
absorbBullet(other);
90-
}*/
87+
if(other.type.hittable && Mathf.within(b.x, b.y, other.x, other.y, size * 2f)){
88+
float realDamage = bulletDamage * damageMultiplier(b);
89+
if(other.damage > realDamage){
90+
other.damage(other.damage - realDamage);
91+
}else{
92+
other.remove();
93+
}
94+
}
9195
}
9296
});
9397
}
@@ -137,19 +141,6 @@ public void despawned(Bullet b){
137141
}
138142
}
139143

140-
public void absorbBullet(Bullet bullet){
141-
if(absorbEffect != Fx.none) absorbEffect.at(bullet.x, bullet.y);
142-
if(bullet.type.trailLength > 0 && bullet.trail != null && bullet.trail.size() > 0){
143-
if(bullet.trail instanceof PMTrail t){
144-
TrailFadeFx.PMTrailFade.at(bullet.x, bullet.y, bullet.type.trailWidth, bullet.type.trailColor, t.copyPM());
145-
}else{
146-
Fx.trailFade.at(bullet.x, bullet.y, bullet.type.trailWidth, bullet.type.trailColor, bullet.trail.copy());
147-
}
148-
}
149-
bullet.type = PMBullets.absorbed;
150-
bullet.absorb();
151-
}
152-
153144
public static boolean checkType(BulletType type){ //Returns true for bullets immune to suction.
154145
return immuneTypes.contains(c -> c.isAssignableFrom(type.getClass()));
155146
}

0 commit comments

Comments
 (0)