mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-26 14:32:06 -08:00
Allow shock mines to spawn bullets (#5454)
* Allow shock mines to spawn bullets * Fix up some issues
This commit is contained in:
parent
38a9ad9ec1
commit
d4c409252b
1 changed files with 18 additions and 4 deletions
|
|
@ -3,8 +3,10 @@ package mindustry.world.blocks.defense;
|
|||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.bullet.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.world.*;
|
||||
|
|
@ -18,6 +20,9 @@ public class ShockMine extends Block{
|
|||
public int length = 10;
|
||||
public int tendrils = 6;
|
||||
public Color lightningColor = Pal.lancerLaser;
|
||||
public int shots = 6;
|
||||
public float inaccuracy = 0f;
|
||||
public @Nullable BulletType bullet;
|
||||
public float teamAlpha = 0.3f;
|
||||
public @Load("@-team-top") TextureRegion teamRegion;
|
||||
|
||||
|
|
@ -46,17 +51,26 @@ public class ShockMine extends Block{
|
|||
|
||||
@Override
|
||||
public void drawCracks(){
|
||||
|
||||
//no
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unitOn(Unit unit){
|
||||
if(enabled && unit.team != team && timer(timerDamage, cooldown)){
|
||||
for(int i = 0; i < tendrils; i++){
|
||||
Lightning.create(team, lightningColor, damage, x, y, Mathf.random(360f), length);
|
||||
}
|
||||
triggered();
|
||||
damage(tileDamage);
|
||||
}
|
||||
}
|
||||
|
||||
public void triggered(){
|
||||
for(int i = 0; i < tendrils; i++){
|
||||
Lightning.create(team, lightningColor, damage, x, y, Mathf.random(360f), length);
|
||||
}
|
||||
if(bullet != null){
|
||||
for(int i = 0; i < shots; i++){
|
||||
bullet.create(this, x, y, (360f / shots) * i + Mathf.random(inaccuracy));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue