Merge pull request #2863 from MEEPofFaith/patch-2

If units can have `chargeSound`, why not `chargeTurret`s too?
This commit is contained in:
Anuken 2020-10-12 10:40:50 -04:00 committed by GitHub
commit fbda1fb7cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -1,10 +1,13 @@
package mindustry.world.blocks.defense.turrets;
import arc.audio.*;
import arc.math.*;
import arc.util.*;
import mindustry.content.*;
import mindustry.entities.*;
import mindustry.entities.bullet.*;
import mindustry.type.*;
import mindustry.gen.*;
import static mindustry.Vars.*;
@ -14,6 +17,7 @@ public class ChargeTurret extends PowerTurret{
public float chargeMaxDelay = 10f;
public Effect chargeEffect = Fx.none;
public Effect chargeBeginEffect = Fx.none;
public Sound chargeSound = Sounds.none;
public ChargeTurret(String name){
super(name);
@ -28,7 +32,8 @@ public class ChargeTurret extends PowerTurret{
tr.trns(rotation, size * tilesize / 2f);
chargeBeginEffect.at(x + tr.x, y + tr.y, rotation);
chargeSound.at(x + tr.x, y + tr.y, 1);
for(int i = 0; i < chargeEffects; i++){
Time.run(Mathf.random(chargeMaxDelay), () -> {
if(!isValid()) return;

View file

@ -434,7 +434,7 @@ public abstract class Turret extends Block{
fshootEffect.at(x + tr.x, y + tr.y, rotation);
fsmokeEffect.at(x + tr.x, y + tr.y, rotation);
shootSound.at(tile, Mathf.random(0.9f, 1.1f));
shootSound.at(x + tr.x, y + tr.y, Mathf.random(0.9f, 1.1f));
if(shootShake > 0){
Effect.shake(shootShake, shootShake, this);