Allow shock mines to spawn bullets (#5454)
* Allow shock mines to spawn bullets * Fix up some issues
This commit is contained in:
@@ -3,8 +3,10 @@ package mindustry.world.blocks.defense;
|
|||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
|
import arc.util.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
|
import mindustry.entities.bullet.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
@@ -18,6 +20,9 @@ public class ShockMine extends Block{
|
|||||||
public int length = 10;
|
public int length = 10;
|
||||||
public int tendrils = 6;
|
public int tendrils = 6;
|
||||||
public Color lightningColor = Pal.lancerLaser;
|
public Color lightningColor = Pal.lancerLaser;
|
||||||
|
public int shots = 6;
|
||||||
|
public float inaccuracy = 0f;
|
||||||
|
public @Nullable BulletType bullet;
|
||||||
public float teamAlpha = 0.3f;
|
public float teamAlpha = 0.3f;
|
||||||
public @Load("@-team-top") TextureRegion teamRegion;
|
public @Load("@-team-top") TextureRegion teamRegion;
|
||||||
|
|
||||||
@@ -46,17 +51,26 @@ public class ShockMine extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawCracks(){
|
public void drawCracks(){
|
||||||
|
//no
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unitOn(Unit unit){
|
public void unitOn(Unit unit){
|
||||||
if(enabled && unit.team != team && timer(timerDamage, cooldown)){
|
if(enabled && unit.team != team && timer(timerDamage, cooldown)){
|
||||||
for(int i = 0; i < tendrils; i++){
|
triggered();
|
||||||
Lightning.create(team, lightningColor, damage, x, y, Mathf.random(360f), length);
|
|
||||||
}
|
|
||||||
damage(tileDamage);
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user