Fracture impl
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 1002 B After Width: | Height: | Size: 998 B |
@@ -2,6 +2,7 @@ package mindustry.content;
|
|||||||
|
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
|
import arc.math.Interp.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
@@ -2863,20 +2864,24 @@ public class Blocks{
|
|||||||
fracture = new ItemTurret("fracture"){{
|
fracture = new ItemTurret("fracture"){{
|
||||||
requirements(Category.turret, with(Items.tungsten, 35, Items.silicon, 35));
|
requirements(Category.turret, with(Items.tungsten, 35, Items.silicon, 35));
|
||||||
ammo(
|
ammo(
|
||||||
Items.tungsten, new ContinuousFlameBulletType(20f){{
|
Items.tungsten, new ContinuousFlameBulletType(45f){{
|
||||||
length = 90f;
|
length = 105f;
|
||||||
shootEffect = Fx.colorSpark;
|
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;
|
smokeEffect = Fx.shootBigSmoke;
|
||||||
|
continuous = false;
|
||||||
ammoMultiplier = 2;
|
ammoMultiplier = 2;
|
||||||
pierce = true;
|
pierce = true;
|
||||||
knockback = 4f;
|
knockback = 4f;
|
||||||
status = StatusEffects.slow;
|
status = StatusEffects.slow;
|
||||||
hitColor = Items.tungsten.color;
|
hitColor = Items.tungsten.color;
|
||||||
lifetime = 16f;
|
lifetime = 19f;
|
||||||
despawnEffect = Fx.none;
|
despawnEffect = Fx.none;
|
||||||
drawFlare = false;
|
drawFlare = false;
|
||||||
lengthInterp = f -> Interp.pow2In.apply(1f - f);
|
collidesAir = true;
|
||||||
//TODO different effect?
|
Interp in = new PowIn(1.6f);
|
||||||
|
lengthInterp = f -> in.apply(1f - f);
|
||||||
hitEffect = Fx.hitBulletColor;
|
hitEffect = Fx.hitBulletColor;
|
||||||
}}
|
}}
|
||||||
);
|
);
|
||||||
@@ -2887,13 +2892,14 @@ public class Blocks{
|
|||||||
|
|
||||||
//TODO cool reload animation
|
//TODO cool reload animation
|
||||||
draw = new DrawTurret("reinforced-");
|
draw = new DrawTurret("reinforced-");
|
||||||
shootShake = 2f;
|
shootShake = 1f;
|
||||||
shootLength = 6f;
|
shootLength = 5f;
|
||||||
outlineColor = Pal.darkOutline;
|
outlineColor = Pal.darkOutline;
|
||||||
size = 2;
|
size = 2;
|
||||||
envEnabled |= Env.space;
|
envEnabled |= Env.space;
|
||||||
reloadTime = 30f;
|
reloadTime = 25f;
|
||||||
restitution = 0.03f;
|
restitution = 0.1f;
|
||||||
|
recoilAmount = 2.5f;
|
||||||
range = 90;
|
range = 90;
|
||||||
shootCone = 15f;
|
shootCone = 15f;
|
||||||
inaccuracy = 0f;
|
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...
|
//TODO just make it properly colored...
|
||||||
tungstenSpark = new Effect(23f, e -> {
|
tungstenSpark = new Effect(23f, e -> {
|
||||||
color(Color.white, Pal.tungstenShot, e.fin());
|
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 -> {
|
Events.on(WorldLoadEvent.class, e -> {
|
||||||
//enable infinite ammo for wave team by default
|
//enable infinite ammo for wave team by default
|
||||||
state.rules.waveTeam.rules().infiniteAmmo = true;
|
state.rules.waveTeam.rules().infiniteAmmo = true;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ public class ContinuousBulletType extends BulletType{
|
|||||||
public float shake = 0f;
|
public float shake = 0f;
|
||||||
public float damageInterval = 5f;
|
public float damageInterval = 5f;
|
||||||
public boolean largeHit = false;
|
public boolean largeHit = false;
|
||||||
|
public boolean continuous = true;
|
||||||
public boolean laserAbsorb = true;
|
public boolean laserAbsorb = true;
|
||||||
/** can't use pierceCap here for... many reasons. DO NOT USE, BUGGY */
|
/** can't use pierceCap here for... many reasons. DO NOT USE, BUGGY */
|
||||||
public int pierceMax = -1;
|
public int pierceMax = -1;
|
||||||
@@ -29,11 +30,13 @@ public class ContinuousBulletType extends BulletType{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float continuousDamage(){
|
public float continuousDamage(){
|
||||||
|
if(!continuous) return -1f;
|
||||||
return damage / damageInterval * 60f;
|
return damage / damageInterval * 60f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float estimateDPS(){
|
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 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
|
//assume it pierces 3 blocks/units
|
||||||
return damage * 100f / damageInterval * 3f;
|
return damage * 100f / damageInterval * 3f;
|
||||||
@@ -51,12 +54,22 @@ public class ContinuousBulletType extends BulletType{
|
|||||||
drawSize = Math.max(drawSize, length*2f);
|
drawSize = Math.max(drawSize, length*2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Bullet b){
|
||||||
|
super.init(b);
|
||||||
|
|
||||||
|
if(!continuous){
|
||||||
|
applyDamage(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Bullet b){
|
public void update(Bullet b){
|
||||||
|
if(!continuous) return;
|
||||||
|
|
||||||
//damage every 5 ticks
|
//damage every 5 ticks
|
||||||
if(b.timer(1, damageInterval)){
|
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){
|
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){
|
public float currentLength(Bullet b){
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public class ContinuousFlameBulletType extends ContinuousBulletType{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float currentLength(Bullet b){
|
public float currentLength(Bullet b){
|
||||||
return length * b.fslope();
|
return length * b.fin(lengthInterp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package mindustry.ui.dialogs;
|
|||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.func.*;
|
import arc.func.*;
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.math.*;
|
|
||||||
import arc.scene.style.*;
|
import arc.scene.style.*;
|
||||||
import arc.scene.ui.*;
|
import arc.scene.ui.*;
|
||||||
import arc.scene.ui.ImageButton.*;
|
import arc.scene.ui.ImageButton.*;
|
||||||
@@ -411,19 +410,6 @@ public class CustomRulesDialog extends BaseDialog{
|
|||||||
add.show();
|
add.show();
|
||||||
}).width(170f);
|
}).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();
|
dialog.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user