Shield and shockwave tower sounds
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package mindustry.entities.abilities;
|
||||
|
||||
import arc.*;
|
||||
import arc.audio.*;
|
||||
import arc.func.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
@@ -30,6 +31,10 @@ public class ForceFieldAbility extends Ability{
|
||||
/** Rotation of shield. */
|
||||
public float rotation = 0f;
|
||||
|
||||
public Sound breakSound = Sounds.shieldBreakSmall;
|
||||
public Sound hitSound = Sounds.shieldHit;
|
||||
public float hitSoundVolume = 0.12f;
|
||||
|
||||
/** State. */
|
||||
protected float radiusScale, alpha;
|
||||
protected boolean wasBroken = true;
|
||||
@@ -37,11 +42,12 @@ public class ForceFieldAbility extends Ability{
|
||||
private static float realRad;
|
||||
private static Unit paramUnit;
|
||||
private static ForceFieldAbility paramField;
|
||||
private static final Cons<Bullet> shieldConsumer = trait -> {
|
||||
if(trait.team != paramUnit.team && trait.type.absorbable && Intersector.isInRegularPolygon(paramField.sides, paramUnit.x, paramUnit.y, realRad, paramField.rotation, trait.x(), trait.y()) && paramUnit.shield > 0){
|
||||
trait.absorb();
|
||||
Fx.absorb.at(trait);
|
||||
paramUnit.shield -= trait.type().shieldDamage(trait);
|
||||
private static final Cons<Bullet> shieldConsumer = b -> {
|
||||
if(b.team != paramUnit.team && b.type.absorbable && Intersector.isInRegularPolygon(paramField.sides, paramUnit.x, paramUnit.y, realRad, paramField.rotation, b.x(), b.y()) && paramUnit.shield > 0){
|
||||
b.absorb();
|
||||
Fx.absorb.at(b);
|
||||
paramField.hitSound.at(b.x, b.y, 1f + Mathf.range(0.1f), paramField.hitSoundVolume);
|
||||
paramUnit.shield -= b.type().shieldDamage(b);
|
||||
paramField.alpha = 1f;
|
||||
}
|
||||
};
|
||||
@@ -82,6 +88,7 @@ public class ForceFieldAbility extends Ability{
|
||||
unit.shield -= cooldown * regen;
|
||||
|
||||
Fx.shieldBreak.at(unit.x, unit.y, radius, unit.type.shieldColor(unit), this);
|
||||
breakSound.at(unit.x, unit.y);
|
||||
}
|
||||
|
||||
wasBroken = unit.shield <= 0f;
|
||||
@@ -110,6 +117,7 @@ public class ForceFieldAbility extends Ability{
|
||||
//self-destructing units can have a shield on death
|
||||
if(unit.shield > 0f && !wasBroken){
|
||||
Fx.shieldBreak.at(unit.x, unit.y, radius, unit.type.shieldColor(unit), this);
|
||||
breakSound.at(unit.x, unit.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import mindustry.graphics.*;
|
||||
import mindustry.ui.*;
|
||||
|
||||
public class ShieldArcAbility extends Ability{
|
||||
|
||||
private static Unit paramUnit;
|
||||
private static ShieldArcAbility paramField;
|
||||
private static Vec2 paramPos = new Vec2();
|
||||
@@ -48,6 +49,8 @@ public class ShieldArcAbility extends Ability{
|
||||
}else{
|
||||
b.absorb();
|
||||
Fx.absorb.at(b);
|
||||
|
||||
paramField.hitSound.at(b.x, b.y, 1f + Mathf.range(0.1f), paramField.hitSoundVolume);
|
||||
}
|
||||
|
||||
// break shield
|
||||
@@ -55,6 +58,8 @@ public class ShieldArcAbility extends Ability{
|
||||
paramField.data -= paramField.cooldown * paramField.regen;
|
||||
|
||||
Fx.arcShieldBreak.at(paramPos.x, paramPos.y, 0, paramField.color == null ? paramUnit.type.shieldColor(paramUnit) : paramField.color, paramUnit);
|
||||
|
||||
paramField.breakSound.at(paramPos.x, paramPos.y);
|
||||
}
|
||||
|
||||
// shieldDamage for consistency
|
||||
@@ -121,6 +126,9 @@ public class ShieldArcAbility extends Ability{
|
||||
public float chanceDeflect = -1f;
|
||||
/** Deflection sound. */
|
||||
public Sound deflectSound = Sounds.none;
|
||||
public Sound breakSound = Sounds.shieldBreakSmall;
|
||||
public Sound hitSound = Sounds.shieldHit;
|
||||
public float hitSoundVolume = 0.12f;
|
||||
/** Multiplier for shield damage taken from missile units. */
|
||||
public float missileUnitMultiplier = 2f;
|
||||
|
||||
|
||||
@@ -376,6 +376,13 @@ public class BulletType extends Content implements Cloneable{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPatch(){
|
||||
super.afterPatch();
|
||||
|
||||
range = calculateRange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
for(var part : parts){
|
||||
|
||||
Reference in New Issue
Block a user