WIP bullet shotgun for T4 tank

This commit is contained in:
Anuken 2022-05-02 22:24:45 -04:00
parent de9a41159f
commit 78f3e23f0b
13 changed files with 48 additions and 14 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 331 B

After

Width:  |  Height:  |  Size: 338 B

View File

@ -290,7 +290,7 @@ public class UnitTypes{
fragBullets = 3;
fragLifeMin = 0f;
fragCone = 30f;
fragRandomSpread = 30f;
fragBullet = new BasicBulletType(9f, 20){{
width = 10f;
@ -2680,11 +2680,11 @@ public class UnitTypes{
sprite = "missile-large";
width = 9.5f;
height = 15f;
lifetime = 30f;
lifetime = 18f;
hitSize = 6f;
shootEffect = Fx.shootTitan;
smokeEffect = Fx.shootSmokeTitan;
pierceCap = 3;
pierceCap = 2;
pierce = true;
pierceBuilding = true;
hitColor = backColor = trailColor = Color.valueOf("feb380");
@ -2694,6 +2694,28 @@ public class UnitTypes{
hitEffect = despawnEffect = Fx.blastExplosion;
splashDamageRadius = 20f;
splashDamage = 50f;
fragOnHit = false;
fragRandomSpread = 0f;
fragSpread = 10f;
fragBullets = 5;
fragVelocityMin = 1f;
//TODO
fragBullet = new BasicBulletType(8f, 30){{
sprite = "missile-large";
width = 8f;
height = 12f;
lifetime = 15f;
hitSize = 4f;
hitColor = backColor = trailColor = Color.valueOf("feb380");
frontColor = Color.white;
trailWidth = 2.8f;
trailLength = 6;
hitEffect = despawnEffect = Fx.blastExplosion;
splashDamageRadius = 10f;
splashDamage = 20f;
}};
}};
}});
@ -3503,7 +3525,7 @@ public class UnitTypes{
spread = 11f;
}};
bullet = new BasicBulletType(5f, 18){{
bullet = new BasicBulletType(5f, 24){{
homingPower = 0.19f;
homingDelay = 4f;
width = 7f;

View File

@ -138,6 +138,8 @@ public class BulletType extends Content implements Cloneable{
public boolean makeFire = false;
/** Whether to create hit effects on despawn. Forced to true if this bullet has any special effects like splash damage. */
public boolean despawnHit = false;
/** If true, this bullet will create bullets when it hits anything, not just when it despawns. */
public boolean fragOnHit = true;
/** If true, unit armor is ignored in damage calculations. Ignored for building armor. */
public boolean pierceArmor = false;
@ -146,7 +148,8 @@ public class BulletType extends Content implements Cloneable{
/** Whether status and despawnHit should automatically be set. */
public boolean setDefaults = true;
public float fragCone = 360f;
public float fragRandomSpread = 360f;
public float fragSpread = 0f;
public float fragAngle = 0f;
public int fragBullets = 9;
public float fragVelocityMin = 0.2f, fragVelocityMax = 1f, fragLifeMin = 1f, fragLifeMax = 1f;
@ -308,12 +311,11 @@ public class BulletType extends Content implements Cloneable{
Effect.shake(hitShake, hitShake, b);
createFrags(b, x, y);
createPuddles(b, x, y);
if(incendChance > 0 && Mathf.chance(incendChance)){
Damage.createIncend(x, y, incendSpread, incendAmount);
if(fragOnHit){
createFrags(b, x, y);
}
createPuddles(b, x, y);
createIncend(b, x, y);
if(suppressionRange > 0){
//bullets are pooled, require separate Vec2 instance
@ -327,6 +329,12 @@ public class BulletType extends Content implements Cloneable{
}
}
public void createIncend(Bullet b, float x, float y){
if(incendChance > 0 && Mathf.chance(incendChance)){
Damage.createIncend(x, y, incendSpread, incendAmount);
}
}
public void createPuddles(Bullet b, float x, float y){
if(puddleLiquid != null && puddles > 0){
for(int i = 0; i < puddles; i++){
@ -361,7 +369,7 @@ public class BulletType extends Content implements Cloneable{
if(fragBullet != null){
for(int i = 0; i < fragBullets; i++){
float len = Mathf.random(1f, 7f);
float a = b.rotation() + Mathf.range(fragCone / 2) + fragAngle;
float a = b.rotation() + Mathf.range(fragRandomSpread / 2) + fragAngle + ((i - fragBullets/2) * fragSpread);
fragBullet.create(b, x + Angles.trnsx(a, len), y + Angles.trnsy(a, len), a, Mathf.random(fragVelocityMin, fragVelocityMax), Mathf.random(fragLifeMin, fragLifeMax));
}
}
@ -373,6 +381,11 @@ public class BulletType extends Content implements Cloneable{
if(despawnHit){
hit(b);
}
if(!fragOnHit){
createFrags(b, b.x, b.y);
}
despawnEffect.at(b.x, b.y, b.rotation(), hitColor);
despawnSound.at(b);

View File

@ -85,7 +85,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
transient float efficiency;
/** Same as efficiency, but for optional consumers only. */
transient float optionalEfficiency;
/** The efficiency this block would have if consValid() / productionValid() returned true. */
/** The efficiency this block *would* have if shouldConsume() returned true. */
transient float potentialEfficiency;
transient float healSuppressionTime = -1f;

View File

@ -187,7 +187,6 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
type.collideFloor && (tile == null || tile.floor().hasSurface() || tile.block() != Blocks.air) ||
type.collideTerrain && tile != null && tile.block() instanceof StaticWall
){
type.despawned(self());
remove();
hit = true;
return;

View File

@ -54,7 +54,7 @@ public class MenuFragment{
parent.fill(c -> c.bottom().right().button(Icon.discord, new ImageButtonStyle(){{
up = discordBanner;
}}, ui.discord::show).tooltip("@discord").size(84, 45).name("discord"));
}}, ui.discord::show).marginTop(9f).marginLeft(10f).tooltip("@discord").size(84, 45).name("discord"));
//info icon
if(mobile){