Turret pattern rewrite
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package mindustry.entities.pattern;
|
||||
|
||||
public class AlternatePattern extends ShotPattern{
|
||||
public class ShootAlternate extends ShootPattern{
|
||||
/** number of barrels used for shooting. */
|
||||
public int barrels = 2;
|
||||
/** spread between barrels, in world units - not degrees. */
|
||||
16
core/src/mindustry/entities/pattern/ShootBarrel.java
Normal file
16
core/src/mindustry/entities/pattern/ShootBarrel.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package mindustry.entities.pattern;
|
||||
|
||||
public class ShootBarrel extends ShootPattern{
|
||||
/** barrels [in x, y, rotation] format. */
|
||||
public float[] barrels = {0f, 0f, 0f};
|
||||
/** offset of barrel to start on */
|
||||
public int barrelOffset = 0;
|
||||
|
||||
@Override
|
||||
public void shoot(int totalShots, BulletHandler handler){
|
||||
for(int i = 0; i < shots; i++){
|
||||
int index = ((i + totalShots + barrelOffset) % (barrels.length / 3)) * 3;
|
||||
handler.shoot(barrels[index], barrels[index + 1], barrels[index + 2], firstShotDelay + shotDelay * i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
package mindustry.entities.pattern;
|
||||
|
||||
public class MultiPattern extends ShotPattern{
|
||||
public ShotPattern source;
|
||||
public ShotPattern[] dest = {};
|
||||
public class ShootMulti extends ShootPattern{
|
||||
public ShootPattern source;
|
||||
public ShootPattern[] dest = {};
|
||||
|
||||
public MultiPattern(ShotPattern source, ShotPattern... dest){
|
||||
public ShootMulti(ShootPattern source, ShootPattern... dest){
|
||||
this.source = source;
|
||||
this.dest = dest;
|
||||
}
|
||||
|
||||
public MultiPattern(){
|
||||
public ShootMulti(){
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,7 +1,7 @@
|
||||
package mindustry.entities.pattern;
|
||||
|
||||
/** Handles different types of bullet patterns for shooting. */
|
||||
public class ShotPattern{
|
||||
public class ShootPattern{
|
||||
/** amount of shots per "trigger pull" */
|
||||
public int shots = 1;
|
||||
/** delay in ticks before first shot */
|
||||
@@ -2,18 +2,18 @@ package mindustry.entities.pattern;
|
||||
|
||||
import arc.math.*;
|
||||
|
||||
public class SinePattern extends ShotPattern{
|
||||
public class ShootSine extends ShootPattern{
|
||||
/** scaling applied to bullet index */
|
||||
public float scl = 4f;
|
||||
/** magnitude of sine curve for position displacement */
|
||||
public float mag = 20f;
|
||||
|
||||
public SinePattern(float scl, float mag){
|
||||
public ShootSine(float scl, float mag){
|
||||
this.scl = scl;
|
||||
this.mag = mag;
|
||||
}
|
||||
|
||||
public SinePattern(){
|
||||
public ShootSine(){
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,6 +1,6 @@
|
||||
package mindustry.entities.pattern;
|
||||
|
||||
public class SpreadPattern extends ShotPattern{
|
||||
public class ShootSpread extends ShootPattern{
|
||||
/** spread between bullets, in degrees. */
|
||||
public float spread = 5f;
|
||||
|
||||
Reference in New Issue
Block a user