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;
range = 100;
shootCone = 15f;
ammoUseEffect = Fx.shellEjectSmall;
ammoUseEffect = Fx.casing1;
health = 250;
inaccuracy = 2f;
rotateSpeed = 10f;
@@ -1593,7 +1593,7 @@ public class Blocks implements ContentList{
shootShake = 1f;
burstSpacing = 3f;
shots = 4;
ammoUseEffect = Fx.shellEjectBig;
ammoUseEffect = Fx.casing2;
health = 240 * size * size;
shootSound = Sounds.shootBig;
}};
@@ -1687,7 +1687,7 @@ public class Blocks implements ContentList{
inaccuracy = 12f;
reloadTime = 60f;
ammoEjectBack = 5f;
ammoUseEffect = Fx.shellEjectBig;
ammoUseEffect = Fx.casing3Double;
ammoPerShot = 2;
cooldown = 0.03f;
velocityInaccuracy = 0.2f;
@@ -1745,7 +1745,7 @@ public class Blocks implements ContentList{
rotateSpeed = 2.5f;
reloadTime = 200f;
restitution = 0.2f;
ammoUseEffect = Fx.shellEjectBig;
ammoUseEffect = Fx.casing3Double;
recoilAmount = 5f;
restitution = 0.009f;
cooldown = 0.009f;
@@ -1774,7 +1774,7 @@ public class Blocks implements ContentList{
reloadTime = 6f;
coolantMultiplier = 0.5f;
restitution = 0.1f;
ammoUseEffect = Fx.shellEjectBig;
ammoUseEffect = Fx.casing3Double;
range = 200f;
inaccuracy = 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());
alpha(e.fout(0.2f));
alpha(e.fout(0.3f));
float rot = Math.abs(e.rotation) + 90f;
int i = -Mathf.sign(e.rotation);
float len = (2f + e.finpow() * 6f) * 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()),
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());
alpha(e.fout(0.5f));
float rot = Math.abs(e.rotation) + 90f;
int i = Mathf.sign(e.rotation);
//for(int i : Mathf.signs){
int i = -Mathf.sign(e.rotation);
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 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);
//}
2f, 3f, rot + e.fin() * 50f * i
);
}
color(Color.lightGray, Color.gray, e.fin());
}).layer(Layer.bullet),
//for(int i : Mathf.signs){
float ex = e.x, ey = e.y, fout = e.fout();
randLenVectors(e.id, 4, 1f + e.finpow() * 11f, e.rotation + 90f * i, 20f, (x, y) -> {
Fill.circle(ex + x, ey + y, fout * 1.5f);
});
//}
casing3Double = 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;
}).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){
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;
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() * 30f * i + Mathf.randomSeedRange(e.id + i + 9, 40f * e.fin()));
rot + e.fin() * 50f * i
);
}
color(Color.lightGray);
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),
}).layer(Layer.bullet),
railShoot = new Effect(24f, e -> {
e.scaled(10f, b -> {

View File

@@ -74,7 +74,7 @@ public class UnitTypes implements ContentList{
x = 4f;
y = 2f;
top = false;
ejectEffect = Fx.shellEjectSmall;
ejectEffect = Fx.casing1;
bullet = Bullets.standardCopper;
}});
}};
@@ -126,7 +126,7 @@ public class UnitTypes implements ContentList{
reload = 60f;
recoil = 4f;
shake = 2f;
ejectEffect = Fx.shellEjectMedium;
ejectEffect = Fx.casing2;
shootSound = Sounds.artillery;
bullet = new ArtilleryBulletType(2f, 8, "shell"){{
hitEffect = Fx.blastExplosion;
@@ -165,7 +165,7 @@ public class UnitTypes implements ContentList{
reload = 45f;
recoil = 5f;
shake = 2f;
ejectEffect = Fx.shellEjectBig;
ejectEffect = Fx.casing3;
shootSound = Sounds.artillery;
shots = 3;
inaccuracy = 3f;
@@ -189,7 +189,7 @@ public class UnitTypes implements ContentList{
x = 8.5f;
y = 6f;
rotate = true;
ejectEffect = Fx.shellEjectSmall;
ejectEffect = Fx.casing1;
bullet = Bullets.standardCopper;
}},
new Weapon("mount-weapon"){{
@@ -197,7 +197,7 @@ public class UnitTypes implements ContentList{
x = 8.5f;
y = -7f;
rotate = true;
ejectEffect = Fx.shellEjectSmall;
ejectEffect = Fx.casing1;
bullet = Bullets.standardCopper;
}}
@@ -225,7 +225,7 @@ public class UnitTypes implements ContentList{
reload = 9f;
recoil = 5f;
shake = 2f;
ejectEffect = Fx.shellEjectBig;
ejectEffect = Fx.casing4;
shootSound = Sounds.artillery;
bullet = new BasicBulletType(13f, 60){{
@@ -737,7 +737,7 @@ public class UnitTypes implements ContentList{
reload = 45;
shake = 3f;
rotateSpeed = 2f;
ejectEffect = Fx.shellEjectSmall;
ejectEffect = Fx.casing1;
shootSound = Sounds.shootBig;
rotate = true;
occlusion = 8f;
@@ -803,7 +803,7 @@ public class UnitTypes implements ContentList{
reload = 30;
shake = 4f;
rotateSpeed = 2f;
ejectEffect = Fx.shellEjectSmall;
ejectEffect = Fx.casing1;
shootSound = Sounds.shootBig;
rotate = true;
occlusion = 12f;
@@ -835,7 +835,7 @@ public class UnitTypes implements ContentList{
shake = 10f;
recoil = 10f;
rotateSpeed = 1f;
ejectEffect = Fx.shellEjectBig;
ejectEffect = Fx.casing3;
shootSound = Sounds.shootBig;
rotate = true;
occlusion = 30f;
@@ -901,7 +901,7 @@ public class UnitTypes implements ContentList{
y = 0f;
x = 2f;
reload = 13f;
ejectEffect = Fx.shellEjectSmall;
ejectEffect = Fx.casing1;
bullet = Bullets.standardCopper;
shootSound = Sounds.shoot;
}});
@@ -1023,7 +1023,7 @@ public class UnitTypes implements ContentList{
y = 8f;
x = 17f;
reload = 20f;
ejectEffect = Fx.shellEjectSmall;
ejectEffect = Fx.casing1;
rotateSpeed = 8f;
bullet = missiles;
shootSound = Sounds.shoot;
@@ -1035,7 +1035,7 @@ public class UnitTypes implements ContentList{
x = 17f;
reload = 35;
rotateSpeed = 8f;
ejectEffect = Fx.shellEjectSmall;
ejectEffect = Fx.casing1;
bullet = missiles;
shootSound = Sounds.shoot;
rotate = true;
@@ -1048,7 +1048,7 @@ public class UnitTypes implements ContentList{
reload = 12;
shake = 1f;
rotateSpeed = 2f;
ejectEffect = Fx.shellEjectSmall;
ejectEffect = Fx.casing1;
shootSound = Sounds.shootBig;
rotate = true;
occlusion = 8f;
@@ -1129,7 +1129,7 @@ public class UnitTypes implements ContentList{
y = -13f;
x = 20f;
reload = 12f;
ejectEffect = Fx.shellEjectSmall;
ejectEffect = Fx.casing1;
rotateSpeed = 7f;
shake = 1f;
shootSound = Sounds.shoot;
@@ -1362,7 +1362,7 @@ public class UnitTypes implements ContentList{
shootY = 4f;
y = 1.5f;
rotate = true;
ejectEffect = Fx.shellEjectSmall;
ejectEffect = Fx.casing1;
bullet = Bullets.standardCopper;
}});
@@ -1372,7 +1372,7 @@ public class UnitTypes implements ContentList{
x = 0f;
y = -5f;
rotate = true;
ejectEffect = Fx.shellEjectSmall;
ejectEffect = Fx.casing1;
bullet = new MissileBulletType(2.7f, 12, "missile"){{
width = 8f;
height = 8f;
@@ -1418,7 +1418,7 @@ public class UnitTypes implements ContentList{
rotate = true;
rotateSpeed = 5f;
inaccuracy = 10f;
ejectEffect = Fx.shellEjectSmall;
ejectEffect = Fx.casing1;
bullet = Bullets.flakLead;
}});
@@ -1430,7 +1430,7 @@ public class UnitTypes implements ContentList{
inaccuracy = 2f;
rotateSpeed = 2f;
shake = 1.5f;
ejectEffect = Fx.shellEjectMedium;
ejectEffect = Fx.casing2;
bullet = Bullets.artilleryIncendiary;
}});
}};
@@ -1466,7 +1466,7 @@ public class UnitTypes implements ContentList{
shots = 1;
inaccuracy = 3f;
ejectEffect = Fx.shellEjectBig;
ejectEffect = Fx.casing3;
bullet = new ArtilleryBulletType(3.2f, 12){{
trailMult = 0.8f;
@@ -1599,7 +1599,7 @@ public class UnitTypes implements ContentList{
shake = 2f;
recoil = 3f;
occlusion = 12f;
ejectEffect = Fx.shellEjectBig;
ejectEffect = Fx.casing3;
shots = 3;
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. */
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))
.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. */
@@ -383,7 +383,7 @@ public class Schematics implements Loadable{
Building tile = world.build(cx, cy);
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();
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];
}
int percent = (int)(used / sum * 100);
Label label = t.add(Core.bundle.format("research.progress", percent)).left().get();
Label label = t.add(Core.bundle.format("research.progress", Math.min((int)(used / sum * 100), 99))).left().get();
if(shiny){
label.setColor(Pal.accent);

View File

@@ -617,7 +617,7 @@ public class Block extends UnlockableContent{
public ItemStack[] researchRequirements(){
ItemStack[] out = new ItemStack[requirements.length];
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));
}

View File

@@ -316,7 +316,7 @@ public abstract class Turret extends ReloadTurret{
if(entry.amount <= 0) ammo.pop();
totalAmmo -= ammoPerShot;
totalAmmo = Math.max(totalAmmo, 0);
Time.run(reloadTime / 2f, this::ejectEffects);
ejectEffects();
return entry.type();
}
@@ -408,7 +408,10 @@ public abstract class Turret extends ReloadTurret{
protected void ejectEffects(){
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