Fixed casing eject effects

This commit is contained in:
Anuken
2020-10-31 20:19:24 -04:00
parent b5e2812d0b
commit 54ba4b31a1
7 changed files with 103 additions and 67 deletions

View File

@@ -1404,7 +1404,7 @@ public class Blocks implements ContentList{
restitution = 0.03f; restitution = 0.03f;
range = 100; range = 100;
shootCone = 15f; shootCone = 15f;
ammoUseEffect = Fx.shellEjectSmall; ammoUseEffect = Fx.casing1;
health = 250; health = 250;
inaccuracy = 2f; inaccuracy = 2f;
rotateSpeed = 10f; rotateSpeed = 10f;
@@ -1593,7 +1593,7 @@ public class Blocks implements ContentList{
shootShake = 1f; shootShake = 1f;
burstSpacing = 3f; burstSpacing = 3f;
shots = 4; shots = 4;
ammoUseEffect = Fx.shellEjectBig; ammoUseEffect = Fx.casing2;
health = 240 * size * size; health = 240 * size * size;
shootSound = Sounds.shootBig; shootSound = Sounds.shootBig;
}}; }};
@@ -1687,7 +1687,7 @@ public class Blocks implements ContentList{
inaccuracy = 12f; inaccuracy = 12f;
reloadTime = 60f; reloadTime = 60f;
ammoEjectBack = 5f; ammoEjectBack = 5f;
ammoUseEffect = Fx.shellEjectBig; ammoUseEffect = Fx.casing3Double;
ammoPerShot = 2; ammoPerShot = 2;
cooldown = 0.03f; cooldown = 0.03f;
velocityInaccuracy = 0.2f; velocityInaccuracy = 0.2f;
@@ -1745,7 +1745,7 @@ public class Blocks implements ContentList{
rotateSpeed = 2.5f; rotateSpeed = 2.5f;
reloadTime = 200f; reloadTime = 200f;
restitution = 0.2f; restitution = 0.2f;
ammoUseEffect = Fx.shellEjectBig; ammoUseEffect = Fx.casing3Double;
recoilAmount = 5f; recoilAmount = 5f;
restitution = 0.009f; restitution = 0.009f;
cooldown = 0.009f; cooldown = 0.009f;
@@ -1774,7 +1774,7 @@ public class Blocks implements ContentList{
reloadTime = 6f; reloadTime = 6f;
coolantMultiplier = 0.5f; coolantMultiplier = 0.5f;
restitution = 0.1f; restitution = 0.1f;
ammoUseEffect = Fx.shellEjectBig; ammoUseEffect = Fx.casing3Double;
range = 200f; range = 200f;
inaccuracy = 3f; inaccuracy = 3f;
recoilAmount = 3f; recoilAmount = 3f;

View File

@@ -1064,68 +1064,102 @@ public class Fx{
}), }),
shellEjectSmall = new Effect(30f, e -> { casing1 = new Effect(30f, e -> {
color(Pal.lightOrange, Color.lightGray, Pal.lightishGray, e.fin()); color(Pal.lightOrange, Color.lightGray, Pal.lightishGray, e.fin());
alpha(e.fout(0.2f)); alpha(e.fout(0.3f));
float rot = Math.abs(e.rotation) + 90f; float rot = Math.abs(e.rotation) + 90f;
int i = -Mathf.sign(e.rotation); int i = -Mathf.sign(e.rotation);
float len = (2f + e.finpow() * 6f) * i; float len = (2f + e.finpow() * 6f) * i;
float lr = rot + e.fin() * 30f * i; float lr = rot + e.fin() * 30f * i;
Fill.rect(e.x + trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()), Fill.rect(
e.x + trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()),
e.y + trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()), e.y + trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()),
1f, 2f, rot + e.fin() * 50f * i); 1f, 2f, rot + e.fin() * 50f * i
);
}).layer(Layer.debris, 400f), }).layer(Layer.bullet),
shellEjectMedium = new Effect(34f, e -> { casing2 = new Effect(34f, e -> {
color(Pal.lightOrange, Color.lightGray, Pal.lightishGray, e.fin()); color(Pal.lightOrange, Color.lightGray, Pal.lightishGray, e.fin());
alpha(e.fout(0.5f));
float rot = Math.abs(e.rotation) + 90f; float rot = Math.abs(e.rotation) + 90f;
int i = Mathf.sign(e.rotation); int i = -Mathf.sign(e.rotation);
//for(int i : Mathf.signs){ float len = (2f + e.finpow() * 10f) * i;
float lr = rot + e.fin() * 20f * i;
rect(Core.atlas.find("casing"),
e.x + trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()),
e.y + trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()),
2f, 3f, rot + e.fin() * 50f * i
);
}).layer(Layer.bullet),
casing3 = new Effect(40f, e -> {
color(Pal.lightOrange, Pal.lightishGray, Pal.lightishGray, e.fin());
alpha(e.fout(0.5f));
float rot = Math.abs(e.rotation) + 90f;
int i = -Mathf.sign(e.rotation);
float len = (4f + e.finpow() * 9f) * i;
float lr = rot + Mathf.randomSeedRange(e.id + i + 6, 20f * e.fin()) * i;
rect(Core.atlas.find("casing"),
e.x + trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()),
e.y + trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()),
2.5f, 4f,
rot + e.fin() * 50f * i
);
}).layer(Layer.bullet),
casing4 = new Effect(45f, e -> {
color(Pal.lightOrange, Pal.lightishGray, Pal.lightishGray, e.fin());
alpha(e.fout(0.5f));
float rot = Math.abs(e.rotation) + 90f;
int i = -Mathf.sign(e.rotation);
float len = (4f + e.finpow() * 9f) * i;
float lr = rot + Mathf.randomSeedRange(e.id + i + 6, 20f * e.fin()) * i;
rect(Core.atlas.find("casing"),
e.x + trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()),
e.y + trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()),
3f, 6f,
rot + e.fin() * 50f * i
);
}).layer(Layer.bullet),
casing2Double = new Effect(34f, e -> {
color(Pal.lightOrange, Color.lightGray, Pal.lightishGray, e.fin());
alpha(e.fout(0.5f));
float rot = Math.abs(e.rotation) + 90f;
for(int i : Mathf.signs){
float len = (2f + e.finpow() * 10f) * i; float len = (2f + e.finpow() * 10f) * i;
float lr = rot + e.fin() * 20f * i; float lr = rot + e.fin() * 20f * i;
rect(Core.atlas.find("casing"), rect(Core.atlas.find("casing"),
e.x + trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()), e.x + trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()),
e.y + trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()), e.y + trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()),
2f, 3f, rot); 2f, 3f, rot + e.fin() * 50f * i
//} );
}
color(Color.lightGray, Color.gray, e.fin()); }).layer(Layer.bullet),
//for(int i : Mathf.signs){ casing3Double = new Effect(40f, e -> {
float ex = e.x, ey = e.y, fout = e.fout(); color(Pal.lightOrange, Pal.lightishGray, Pal.lightishGray, e.fin());
randLenVectors(e.id, 4, 1f + e.finpow() * 11f, e.rotation + 90f * i, 20f, (x, y) -> { alpha(e.fout(0.5f));
Fill.circle(ex + x, ey + y, fout * 1.5f); float rot = Math.abs(e.rotation) + 90f;
});
//}
}).layer(Layer.debris, 400f),
shellEjectBig = new Effect(22f, e -> {
color(Pal.lightOrange, Color.lightGray, Pal.lightishGray, e.fin());
float rot = e.rotation + 90f;
for(int i : Mathf.signs){ for(int i : Mathf.signs){
float len = (4f + e.finpow() * 8f) * i; float len = (4f + e.finpow() * 9f) * i;
float lr = rot + Mathf.randomSeedRange(e.id + i + 6, 20f * e.fin()) * i; float lr = rot + Mathf.randomSeedRange(e.id + i + 6, 20f * e.fin()) * i;
rect(Core.atlas.find("casing"), rect(Core.atlas.find("casing"),
e.x + trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()), e.x + trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()),
e.y + trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()), e.y + trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()),
2.5f, 4f, 2.5f, 4f,
rot + e.fin() * 30f * i + Mathf.randomSeedRange(e.id + i + 9, 40f * e.fin())); rot + e.fin() * 50f * i
);
} }
color(Color.lightGray); }).layer(Layer.bullet),
for(int i : Mathf.signs){
float ex = e.x, ey = e.y, fout = e.fout();
randLenVectors(e.id, 4, -e.finpow() * 15f, e.rotation + 90f * i, 25f, (x, y) -> {
Fill.circle(ex + x, ey + y, fout * 2f);
});
}
}).layer(Layer.debris, 400f),
railShoot = new Effect(24f, e -> { railShoot = new Effect(24f, e -> {
e.scaled(10f, b -> { e.scaled(10f, b -> {

View File

@@ -74,7 +74,7 @@ public class UnitTypes implements ContentList{
x = 4f; x = 4f;
y = 2f; y = 2f;
top = false; top = false;
ejectEffect = Fx.shellEjectSmall; ejectEffect = Fx.casing1;
bullet = Bullets.standardCopper; bullet = Bullets.standardCopper;
}}); }});
}}; }};
@@ -126,7 +126,7 @@ public class UnitTypes implements ContentList{
reload = 60f; reload = 60f;
recoil = 4f; recoil = 4f;
shake = 2f; shake = 2f;
ejectEffect = Fx.shellEjectMedium; ejectEffect = Fx.casing2;
shootSound = Sounds.artillery; shootSound = Sounds.artillery;
bullet = new ArtilleryBulletType(2f, 8, "shell"){{ bullet = new ArtilleryBulletType(2f, 8, "shell"){{
hitEffect = Fx.blastExplosion; hitEffect = Fx.blastExplosion;
@@ -165,7 +165,7 @@ public class UnitTypes implements ContentList{
reload = 45f; reload = 45f;
recoil = 5f; recoil = 5f;
shake = 2f; shake = 2f;
ejectEffect = Fx.shellEjectBig; ejectEffect = Fx.casing3;
shootSound = Sounds.artillery; shootSound = Sounds.artillery;
shots = 3; shots = 3;
inaccuracy = 3f; inaccuracy = 3f;
@@ -189,7 +189,7 @@ public class UnitTypes implements ContentList{
x = 8.5f; x = 8.5f;
y = 6f; y = 6f;
rotate = true; rotate = true;
ejectEffect = Fx.shellEjectSmall; ejectEffect = Fx.casing1;
bullet = Bullets.standardCopper; bullet = Bullets.standardCopper;
}}, }},
new Weapon("mount-weapon"){{ new Weapon("mount-weapon"){{
@@ -197,7 +197,7 @@ public class UnitTypes implements ContentList{
x = 8.5f; x = 8.5f;
y = -7f; y = -7f;
rotate = true; rotate = true;
ejectEffect = Fx.shellEjectSmall; ejectEffect = Fx.casing1;
bullet = Bullets.standardCopper; bullet = Bullets.standardCopper;
}} }}
@@ -225,7 +225,7 @@ public class UnitTypes implements ContentList{
reload = 9f; reload = 9f;
recoil = 5f; recoil = 5f;
shake = 2f; shake = 2f;
ejectEffect = Fx.shellEjectBig; ejectEffect = Fx.casing4;
shootSound = Sounds.artillery; shootSound = Sounds.artillery;
bullet = new BasicBulletType(13f, 60){{ bullet = new BasicBulletType(13f, 60){{
@@ -737,7 +737,7 @@ public class UnitTypes implements ContentList{
reload = 45; reload = 45;
shake = 3f; shake = 3f;
rotateSpeed = 2f; rotateSpeed = 2f;
ejectEffect = Fx.shellEjectSmall; ejectEffect = Fx.casing1;
shootSound = Sounds.shootBig; shootSound = Sounds.shootBig;
rotate = true; rotate = true;
occlusion = 8f; occlusion = 8f;
@@ -803,7 +803,7 @@ public class UnitTypes implements ContentList{
reload = 30; reload = 30;
shake = 4f; shake = 4f;
rotateSpeed = 2f; rotateSpeed = 2f;
ejectEffect = Fx.shellEjectSmall; ejectEffect = Fx.casing1;
shootSound = Sounds.shootBig; shootSound = Sounds.shootBig;
rotate = true; rotate = true;
occlusion = 12f; occlusion = 12f;
@@ -835,7 +835,7 @@ public class UnitTypes implements ContentList{
shake = 10f; shake = 10f;
recoil = 10f; recoil = 10f;
rotateSpeed = 1f; rotateSpeed = 1f;
ejectEffect = Fx.shellEjectBig; ejectEffect = Fx.casing3;
shootSound = Sounds.shootBig; shootSound = Sounds.shootBig;
rotate = true; rotate = true;
occlusion = 30f; occlusion = 30f;
@@ -901,7 +901,7 @@ public class UnitTypes implements ContentList{
y = 0f; y = 0f;
x = 2f; x = 2f;
reload = 13f; reload = 13f;
ejectEffect = Fx.shellEjectSmall; ejectEffect = Fx.casing1;
bullet = Bullets.standardCopper; bullet = Bullets.standardCopper;
shootSound = Sounds.shoot; shootSound = Sounds.shoot;
}}); }});
@@ -1023,7 +1023,7 @@ public class UnitTypes implements ContentList{
y = 8f; y = 8f;
x = 17f; x = 17f;
reload = 20f; reload = 20f;
ejectEffect = Fx.shellEjectSmall; ejectEffect = Fx.casing1;
rotateSpeed = 8f; rotateSpeed = 8f;
bullet = missiles; bullet = missiles;
shootSound = Sounds.shoot; shootSound = Sounds.shoot;
@@ -1035,7 +1035,7 @@ public class UnitTypes implements ContentList{
x = 17f; x = 17f;
reload = 35; reload = 35;
rotateSpeed = 8f; rotateSpeed = 8f;
ejectEffect = Fx.shellEjectSmall; ejectEffect = Fx.casing1;
bullet = missiles; bullet = missiles;
shootSound = Sounds.shoot; shootSound = Sounds.shoot;
rotate = true; rotate = true;
@@ -1048,7 +1048,7 @@ public class UnitTypes implements ContentList{
reload = 12; reload = 12;
shake = 1f; shake = 1f;
rotateSpeed = 2f; rotateSpeed = 2f;
ejectEffect = Fx.shellEjectSmall; ejectEffect = Fx.casing1;
shootSound = Sounds.shootBig; shootSound = Sounds.shootBig;
rotate = true; rotate = true;
occlusion = 8f; occlusion = 8f;
@@ -1129,7 +1129,7 @@ public class UnitTypes implements ContentList{
y = -13f; y = -13f;
x = 20f; x = 20f;
reload = 12f; reload = 12f;
ejectEffect = Fx.shellEjectSmall; ejectEffect = Fx.casing1;
rotateSpeed = 7f; rotateSpeed = 7f;
shake = 1f; shake = 1f;
shootSound = Sounds.shoot; shootSound = Sounds.shoot;
@@ -1362,7 +1362,7 @@ public class UnitTypes implements ContentList{
shootY = 4f; shootY = 4f;
y = 1.5f; y = 1.5f;
rotate = true; rotate = true;
ejectEffect = Fx.shellEjectSmall; ejectEffect = Fx.casing1;
bullet = Bullets.standardCopper; bullet = Bullets.standardCopper;
}}); }});
@@ -1372,7 +1372,7 @@ public class UnitTypes implements ContentList{
x = 0f; x = 0f;
y = -5f; y = -5f;
rotate = true; rotate = true;
ejectEffect = Fx.shellEjectSmall; ejectEffect = Fx.casing1;
bullet = new MissileBulletType(2.7f, 12, "missile"){{ bullet = new MissileBulletType(2.7f, 12, "missile"){{
width = 8f; width = 8f;
height = 8f; height = 8f;
@@ -1418,7 +1418,7 @@ public class UnitTypes implements ContentList{
rotate = true; rotate = true;
rotateSpeed = 5f; rotateSpeed = 5f;
inaccuracy = 10f; inaccuracy = 10f;
ejectEffect = Fx.shellEjectSmall; ejectEffect = Fx.casing1;
bullet = Bullets.flakLead; bullet = Bullets.flakLead;
}}); }});
@@ -1430,7 +1430,7 @@ public class UnitTypes implements ContentList{
inaccuracy = 2f; inaccuracy = 2f;
rotateSpeed = 2f; rotateSpeed = 2f;
shake = 1.5f; shake = 1.5f;
ejectEffect = Fx.shellEjectMedium; ejectEffect = Fx.casing2;
bullet = Bullets.artilleryIncendiary; bullet = Bullets.artilleryIncendiary;
}}); }});
}}; }};
@@ -1466,7 +1466,7 @@ public class UnitTypes implements ContentList{
shots = 1; shots = 1;
inaccuracy = 3f; inaccuracy = 3f;
ejectEffect = Fx.shellEjectBig; ejectEffect = Fx.casing3;
bullet = new ArtilleryBulletType(3.2f, 12){{ bullet = new ArtilleryBulletType(3.2f, 12){{
trailMult = 0.8f; trailMult = 0.8f;
@@ -1599,7 +1599,7 @@ public class UnitTypes implements ContentList{
shake = 2f; shake = 2f;
recoil = 3f; recoil = 3f;
occlusion = 12f; occlusion = 12f;
ejectEffect = Fx.shellEjectBig; ejectEffect = Fx.casing3;
shots = 3; shots = 3;
shotDelay = 4f; shotDelay = 4f;

View File

@@ -281,7 +281,7 @@ public class Schematics implements Loadable{
/** Creates an array of build requests from a schematic's data, centered on the provided x+y coordinates. */ /** Creates an array of build requests from a schematic's data, centered on the provided x+y coordinates. */
public Seq<BuildPlan> toRequests(Schematic schem, int x, int y){ public Seq<BuildPlan> toRequests(Schematic schem, int x, int y){
return schem.tiles.map(t -> new BuildPlan(t.x + x - schem.width/2, t.y + y - schem.height/2, t.rotation, t.block, t.config).original(t.x, t.y, schem.width, schem.height)) return schem.tiles.map(t -> new BuildPlan(t.x + x - schem.width/2, t.y + y - schem.height/2, t.rotation, t.block, t.config).original(t.x, t.y, schem.width, schem.height))
.removeAll(s -> !s.block.isVisible() || !s.block.unlockedNow()); .removeAll(s -> (!s.block.isVisible() && !(s.block instanceof CoreBlock)) || !s.block.unlockedNow());
} }
/** @return all the valid loadouts for a specific core type. */ /** @return all the valid loadouts for a specific core type. */
@@ -383,7 +383,7 @@ public class Schematics implements Loadable{
Building tile = world.build(cx, cy); Building tile = world.build(cx, cy);
if(tile != null && !counted.contains(tile.pos()) && !(tile.block instanceof ConstructBlock) if(tile != null && !counted.contains(tile.pos()) && !(tile.block instanceof ConstructBlock)
&& (tile.block.isVisible() || (tile.block instanceof CoreBlock))){ && (tile.block.isVisible() || tile.block instanceof CoreBlock)){
Object config = tile.config(); Object config = tile.config();
tiles.add(new Stile(tile.block, tile.tileX() + offsetX, tile.tileY() + offsetY, config, (byte)tile.rotation)); tiles.add(new Stile(tile.block, tile.tileX() + offsetX, tile.tileY() + offsetY, config, (byte)tile.rotation));

View File

@@ -509,8 +509,7 @@ public class ResearchDialog extends BaseDialog{
if(shine != null) shiny |= shine[i]; if(shine != null) shiny |= shine[i];
} }
int percent = (int)(used / sum * 100); Label label = t.add(Core.bundle.format("research.progress", Math.min((int)(used / sum * 100), 99))).left().get();
Label label = t.add(Core.bundle.format("research.progress", percent)).left().get();
if(shiny){ if(shiny){
label.setColor(Pal.accent); label.setColor(Pal.accent);

View File

@@ -617,7 +617,7 @@ public class Block extends UnlockableContent{
public ItemStack[] researchRequirements(){ public ItemStack[] researchRequirements(){
ItemStack[] out = new ItemStack[requirements.length]; ItemStack[] out = new ItemStack[requirements.length];
for(int i = 0; i < out.length; i++){ for(int i = 0; i < out.length; i++){
int quantity = 60 + Mathf.round(Mathf.pow(requirements[i].amount, 1.1f) * 20 * researchCostMultiplier, 10); int quantity = 60 + Mathf.round(Mathf.pow(requirements[i].amount, 1.09f) * 20 * researchCostMultiplier, 10);
out[i] = new ItemStack(requirements[i].item, UI.roundAmount(quantity)); out[i] = new ItemStack(requirements[i].item, UI.roundAmount(quantity));
} }

View File

@@ -316,7 +316,7 @@ public abstract class Turret extends ReloadTurret{
if(entry.amount <= 0) ammo.pop(); if(entry.amount <= 0) ammo.pop();
totalAmmo -= ammoPerShot; totalAmmo -= ammoPerShot;
totalAmmo = Math.max(totalAmmo, 0); totalAmmo = Math.max(totalAmmo, 0);
Time.run(reloadTime / 2f, this::ejectEffects); ejectEffects();
return entry.type(); return entry.type();
} }
@@ -408,7 +408,10 @@ public abstract class Turret extends ReloadTurret{
protected void ejectEffects(){ protected void ejectEffects(){
if(!isValid()) return; if(!isValid()) return;
ammoUseEffect.at(x - Angles.trnsx(rotation, ammoEjectBack), y - Angles.trnsy(rotation, ammoEjectBack), rotation); //alternate sides when using a double turret
float scl = (shots == 2 && alternate && shotCounter % 2 == 1 ? -1f : 1f);
ammoUseEffect.at(x - Angles.trnsx(rotation, ammoEjectBack), y - Angles.trnsy(rotation, ammoEjectBack), rotation * scl);
} }
@Override @Override