mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-24 21:41:25 -08:00
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:
parent
34032f63a5
commit
b7cb080f36
2 changed files with 15 additions and 1 deletions
|
|
@ -4,8 +4,10 @@ import arc.graphics.*;
|
|||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.blocks.distribution.MassDriver.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
|
@ -89,5 +91,17 @@ public class MassDriverBolt extends BasicBulletType{
|
|||
public void hit(Bullet b, float hitx, float hity){
|
||||
super.hit(b, hitx, hity);
|
||||
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,
|
||||
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);
|
||||
smokeEffect.at(x + Angles.trnsx(angle, translation), y + Angles.trnsy(angle, translation), angle);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue