Fracture impl
This commit is contained in:
@@ -2,6 +2,7 @@ package mindustry.content;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.math.*;
|
||||
import arc.math.Interp.*;
|
||||
import arc.struct.*;
|
||||
import mindustry.*;
|
||||
import mindustry.entities.*;
|
||||
@@ -2863,20 +2864,24 @@ public class Blocks{
|
||||
fracture = new ItemTurret("fracture"){{
|
||||
requirements(Category.turret, with(Items.tungsten, 35, Items.silicon, 35));
|
||||
ammo(
|
||||
Items.tungsten, new ContinuousFlameBulletType(20f){{
|
||||
length = 90f;
|
||||
shootEffect = Fx.colorSpark;
|
||||
Items.tungsten, new ContinuousFlameBulletType(45f){{
|
||||
length = 105f;
|
||||
shootEffect = Fx.randLifeSpark;
|
||||
width = 4.5f;
|
||||
colors = new Color[]{Color.valueOf("e8e6ff").a(0.55f), Color.valueOf("819aeb").a(0.7f), Color.valueOf("786bed").a(0.8f), Color.valueOf("c3cdfa"), Color.white};
|
||||
smokeEffect = Fx.shootBigSmoke;
|
||||
continuous = false;
|
||||
ammoMultiplier = 2;
|
||||
pierce = true;
|
||||
knockback = 4f;
|
||||
status = StatusEffects.slow;
|
||||
hitColor = Items.tungsten.color;
|
||||
lifetime = 16f;
|
||||
lifetime = 19f;
|
||||
despawnEffect = Fx.none;
|
||||
drawFlare = false;
|
||||
lengthInterp = f -> Interp.pow2In.apply(1f - f);
|
||||
//TODO different effect?
|
||||
collidesAir = true;
|
||||
Interp in = new PowIn(1.6f);
|
||||
lengthInterp = f -> in.apply(1f - f);
|
||||
hitEffect = Fx.hitBulletColor;
|
||||
}}
|
||||
);
|
||||
@@ -2887,13 +2892,14 @@ public class Blocks{
|
||||
|
||||
//TODO cool reload animation
|
||||
draw = new DrawTurret("reinforced-");
|
||||
shootShake = 2f;
|
||||
shootLength = 6f;
|
||||
shootShake = 1f;
|
||||
shootLength = 5f;
|
||||
outlineColor = Pal.darkOutline;
|
||||
size = 2;
|
||||
envEnabled |= Env.space;
|
||||
reloadTime = 30f;
|
||||
restitution = 0.03f;
|
||||
reloadTime = 25f;
|
||||
restitution = 0.1f;
|
||||
recoilAmount = 2.5f;
|
||||
range = 90;
|
||||
shootCone = 15f;
|
||||
inaccuracy = 0f;
|
||||
|
||||
@@ -1458,6 +1458,20 @@ public class Fx{
|
||||
});
|
||||
}),
|
||||
|
||||
randLifeSpark = new Effect(24f, e -> {
|
||||
color(Color.white, e.color, e.fin());
|
||||
stroke(e.fout() * 1.5f + 0.5f);
|
||||
|
||||
rand.setSeed(e.id);
|
||||
for(int i = 0; i < 15; i++){
|
||||
float ang = e.rotation + rand.range(9f), len = rand.random(90f * e.finpow());
|
||||
e.scaled(e.lifetime * rand.random(0.5f, 1f), p -> {
|
||||
v.trns(ang, len);
|
||||
lineAngle(e.x + v.x, e.y + v.y, ang, p.fout() * 7f + 0.5f);
|
||||
});
|
||||
}
|
||||
}),
|
||||
|
||||
//TODO just make it properly colored...
|
||||
tungstenSpark = new Effect(23f, e -> {
|
||||
color(Color.white, Pal.tungstenShot, e.fin());
|
||||
|
||||
@@ -95,6 +95,16 @@ public class Logic implements ApplicationListener{
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(PlayEvent.class, e -> {
|
||||
//reset weather on play
|
||||
var randomWeather = state.rules.weather.copy().shuffle();
|
||||
float sum = 0f;
|
||||
for(var weather : randomWeather){
|
||||
weather.cooldown = sum + Mathf.random(weather.maxFrequency);
|
||||
sum += weather.cooldown;
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(WorldLoadEvent.class, e -> {
|
||||
//enable infinite ammo for wave team by default
|
||||
state.rules.waveTeam.rules().infiniteAmmo = true;
|
||||
|
||||
@@ -10,6 +10,7 @@ public class ContinuousBulletType extends BulletType{
|
||||
public float shake = 0f;
|
||||
public float damageInterval = 5f;
|
||||
public boolean largeHit = false;
|
||||
public boolean continuous = true;
|
||||
public boolean laserAbsorb = true;
|
||||
/** can't use pierceCap here for... many reasons. DO NOT USE, BUGGY */
|
||||
public int pierceMax = -1;
|
||||
@@ -29,11 +30,13 @@ public class ContinuousBulletType extends BulletType{
|
||||
|
||||
@Override
|
||||
public float continuousDamage(){
|
||||
if(!continuous) return -1f;
|
||||
return damage / damageInterval * 60f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float estimateDPS(){
|
||||
if(!continuous) return super.estimateDPS();
|
||||
//assume firing duration is about 100 by default, may not be accurate there's no way of knowing in this method
|
||||
//assume it pierces 3 blocks/units
|
||||
return damage * 100f / damageInterval * 3f;
|
||||
@@ -51,12 +54,22 @@ public class ContinuousBulletType extends BulletType{
|
||||
drawSize = Math.max(drawSize, length*2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Bullet b){
|
||||
super.init(b);
|
||||
|
||||
if(!continuous){
|
||||
applyDamage(b);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Bullet b){
|
||||
if(!continuous) return;
|
||||
|
||||
//damage every 5 ticks
|
||||
if(b.timer(1, damageInterval)){
|
||||
Damage.collideLine(b, b.team, hitEffect, b.x, b.y, b.rotation(), currentLength(b), largeHit, laserAbsorb, pierceMax);
|
||||
applyDamage(b);
|
||||
}
|
||||
|
||||
if(shake > 0){
|
||||
@@ -64,6 +77,10 @@ public class ContinuousBulletType extends BulletType{
|
||||
}
|
||||
}
|
||||
|
||||
public void applyDamage(Bullet b){
|
||||
Damage.collideLine(b, b.team, hitEffect, b.x, b.y, b.rotation(), currentLength(b), largeHit, laserAbsorb, pierceMax);
|
||||
}
|
||||
|
||||
public float currentLength(Bullet b){
|
||||
return length;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public class ContinuousFlameBulletType extends ContinuousBulletType{
|
||||
|
||||
@Override
|
||||
public float currentLength(Bullet b){
|
||||
return length * b.fslope();
|
||||
return length * b.fin(lengthInterp);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,7 +3,6 @@ package mindustry.ui.dialogs;
|
||||
import arc.*;
|
||||
import arc.func.*;
|
||||
import arc.graphics.*;
|
||||
import arc.math.*;
|
||||
import arc.scene.style.*;
|
||||
import arc.scene.ui.*;
|
||||
import arc.scene.ui.ImageButton.*;
|
||||
@@ -411,19 +410,6 @@ public class CustomRulesDialog extends BaseDialog{
|
||||
add.show();
|
||||
}).width(170f);
|
||||
|
||||
//reset cooldown to random number
|
||||
dialog.hidden(() -> {
|
||||
float sum = 0;
|
||||
Seq<WeatherEntry> sh = rules.weather.copy();
|
||||
sh.shuffle();
|
||||
|
||||
for(WeatherEntry w : sh){
|
||||
//add the previous cooldowns to the sum so weather events are staggered and don't happen all at once.
|
||||
w.cooldown = sum + Mathf.random(w.minFrequency, w.maxFrequency);
|
||||
sum += w.cooldown;
|
||||
}
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user