mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-05 07:47:48 +07:00
Weapon charge sound
This commit is contained in:
@ -166,14 +166,15 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc, Velc, Statusc{
|
|||||||
Weapon weapon = mount.weapon;
|
Weapon weapon = mount.weapon;
|
||||||
|
|
||||||
float baseX = this.x, baseY = this.y;
|
float baseX = this.x, baseY = this.y;
|
||||||
|
boolean delay = weapon.firstShotDelay > 0f;
|
||||||
|
|
||||||
weapon.shootSound.at(x, y, Mathf.random(0.8f, 1.0f));
|
(delay ? weapon.chargeSound : weapon.shootSound).at(x, y, Mathf.random(0.8f, 1.0f));
|
||||||
|
|
||||||
BulletType ammo = weapon.bullet;
|
BulletType ammo = weapon.bullet;
|
||||||
float lifeScl = ammo.scaleVelocity ? Mathf.clamp(Mathf.dst(x, y, aimX, aimY) / ammo.range()) : 1f;
|
float lifeScl = ammo.scaleVelocity ? Mathf.clamp(Mathf.dst(x, y, aimX, aimY) / ammo.range()) : 1f;
|
||||||
|
|
||||||
sequenceNum = 0;
|
sequenceNum = 0;
|
||||||
if(weapon.shotDelay + weapon.firstShotDelay > 0.01f){
|
if(delay){
|
||||||
Angles.shotgun(weapon.shots, weapon.spacing, rotation, f -> {
|
Angles.shotgun(weapon.shots, weapon.spacing, rotation, f -> {
|
||||||
Time.run(sequenceNum * weapon.shotDelay + weapon.firstShotDelay, () -> {
|
Time.run(sequenceNum * weapon.shotDelay + weapon.firstShotDelay, () -> {
|
||||||
if(!isAdded()) return;
|
if(!isAdded()) return;
|
||||||
@ -187,13 +188,14 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc, Velc, Statusc{
|
|||||||
|
|
||||||
boolean parentize = ammo.keepVelocity;
|
boolean parentize = ammo.keepVelocity;
|
||||||
|
|
||||||
if(weapon.firstShotDelay > 0){
|
if(delay){
|
||||||
Time.run(weapon.firstShotDelay, () -> {
|
Time.run(weapon.firstShotDelay, () -> {
|
||||||
if(!isAdded()) return;
|
if(!isAdded()) return;
|
||||||
|
|
||||||
vel.add(Tmp.v1.trns(rotation + 180f, ammo.recoil));
|
vel.add(Tmp.v1.trns(rotation + 180f, ammo.recoil));
|
||||||
Effect.shake(weapon.shake, weapon.shake, x, y);
|
Effect.shake(weapon.shake, weapon.shake, x, y);
|
||||||
mount.heat = 1f;
|
mount.heat = 1f;
|
||||||
|
weapon.shootSound.at(x, y, Mathf.random(0.8f, 1.0f));
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
vel.add(Tmp.v1.trns(rotation + 180f, ammo.recoil));
|
vel.add(Tmp.v1.trns(rotation + 180f, ammo.recoil));
|
||||||
|
@ -266,7 +266,30 @@ public class DefaultWaves{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int bossWave = Mathf.random(30, 60);
|
||||||
|
int bossSpacing = Mathf.random(30, 50);
|
||||||
|
|
||||||
|
//main boss progression
|
||||||
|
out.add(new SpawnGroup(Structs.random(species)[4]){{
|
||||||
|
unitAmount = 1;
|
||||||
|
begin = bossWave;
|
||||||
|
spacing = bossSpacing;
|
||||||
|
end = never;
|
||||||
|
max = 16;
|
||||||
|
unitScaling = bossSpacing;
|
||||||
|
shieldScaling = shieldsPerWave;
|
||||||
|
}});
|
||||||
|
|
||||||
|
//alt boss progression
|
||||||
|
out.add(new SpawnGroup(Structs.random(species)[4]){{
|
||||||
|
unitAmount = 1;
|
||||||
|
begin = bossWave + Mathf.random(4, 6) * bossSpacing;
|
||||||
|
spacing = bossSpacing;
|
||||||
|
end = never;
|
||||||
|
max = 16;
|
||||||
|
unitScaling = bossSpacing;
|
||||||
|
shieldScaling = shieldsPerWave;
|
||||||
|
}});
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,8 @@ public class Weapon{
|
|||||||
public int otherSide = -1;
|
public int otherSide = -1;
|
||||||
/** sound used for shooting */
|
/** sound used for shooting */
|
||||||
public Sound shootSound = Sounds.pew;
|
public Sound shootSound = Sounds.pew;
|
||||||
|
/** sound used for weapons that have a delay */
|
||||||
|
public Sound chargeSound = Sounds.none;
|
||||||
/** sound played when there is nothing to shoot */
|
/** sound played when there is nothing to shoot */
|
||||||
public Sound noAmmoSound = Sounds.click;
|
public Sound noAmmoSound = Sounds.click;
|
||||||
/** displayed region (autoloaded) */
|
/** displayed region (autoloaded) */
|
||||||
|
Reference in New Issue
Block a user