Mass driver bullets are destroyed like the blocks with items (#10969)
* Mass driver bullets explosions like the blocks * Better code style --------- Co-authored-by: TempUser <temp@mail>
This commit is contained in:
@@ -4,8 +4,10 @@ import arc.graphics.*;
|
|||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
|
import mindustry.entities.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
|
import mindustry.type.*;
|
||||||
import mindustry.world.blocks.distribution.MassDriver.*;
|
import mindustry.world.blocks.distribution.MassDriver.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
@@ -89,5 +91,17 @@ public class MassDriverBolt extends BasicBulletType{
|
|||||||
public void hit(Bullet b, float hitx, float hity){
|
public void hit(Bullet b, float hitx, float hity){
|
||||||
super.hit(b, hitx, hity);
|
super.hit(b, hitx, hity);
|
||||||
despawned(b);
|
despawned(b);
|
||||||
|
if(b.data() instanceof DriverBulletData data){
|
||||||
|
float explosiveness = 0f;
|
||||||
|
float flammability = 0f;
|
||||||
|
float power = 0f;
|
||||||
|
for(int i = 0; i < data.items.length; i++){
|
||||||
|
Item item = content.item(i);
|
||||||
|
explosiveness += item.explosiveness * data.items[i];
|
||||||
|
flammability += item.flammability * data.items[i];
|
||||||
|
power += item.charge * Mathf.pow(data.items[i], 1.1f) * 25f;
|
||||||
|
}
|
||||||
|
Damage.dynamicExplosion(b.x, b.y, flammability / 10f, explosiveness / 10f, power, 1f, state.rules.damageExplosions);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ public class MassDriver extends Block{
|
|||||||
|
|
||||||
bullet.create(this, team,
|
bullet.create(this, team,
|
||||||
x + Angles.trnsx(angle, translation), y + Angles.trnsy(angle, translation),
|
x + Angles.trnsx(angle, translation), y + Angles.trnsy(angle, translation),
|
||||||
angle, -1f, bulletSpeed, bulletLifetime, data);
|
angle, totalUsed/2f, bulletSpeed, bulletLifetime, data);
|
||||||
|
|
||||||
shootEffect.at(x + Angles.trnsx(angle, translation), y + Angles.trnsy(angle, translation), angle);
|
shootEffect.at(x + Angles.trnsx(angle, translation), y + Angles.trnsy(angle, translation), angle);
|
||||||
smokeEffect.at(x + Angles.trnsx(angle, translation), y + Angles.trnsy(angle, translation), angle);
|
smokeEffect.at(x + Angles.trnsx(angle, translation), y + Angles.trnsy(angle, translation), angle);
|
||||||
|
|||||||
Reference in New Issue
Block a user