more sounds

This commit is contained in:
Anuken
2019-08-13 11:42:01 -04:00
parent a818da5eb7
commit bff9d89232
35 changed files with 104 additions and 48 deletions

View File

@@ -1374,6 +1374,7 @@ public class Blocks implements ContentList{
shootEffect = Fx.shootLiquid;
range = 110f;
health = 250 * size * size;
shootSound = Sounds.splash;
drawer = (tile, entity) -> {
Draw.rect(region, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
@@ -1405,7 +1406,7 @@ public class Blocks implements ContentList{
size = 2;
health = 280 * size * size;
targetAir = false;
shootSound = Sounds.phaser;
shootSound = Sounds.laser;
}};
arc = new PowerTurret("arc"){{
@@ -1422,7 +1423,7 @@ public class Blocks implements ContentList{
recoil = 1f;
size = 1;
health = 260;
shootSound = Sounds.shock;
shootSound = Sounds.spark;
}};
swarmer = new BurstTurret("swarmer"){{
@@ -1464,7 +1465,8 @@ public class Blocks implements ContentList{
burstSpacing = 3f;
shots = 4;
ammoUseEffect = Fx.shellEjectBig;
health = 240 * size * size;;
health = 240 * size * size;
shootSound = Sounds.shootBig;
}};
fuse = new ItemTurret("fuse"){{
@@ -1561,6 +1563,7 @@ public class Blocks implements ContentList{
rotatespeed = 10f;
inaccuracy = 10f;
shootCone = 30f;
shootSound = Sounds.shootSnap;
health = 145 * size * size;
}};
@@ -1585,6 +1588,7 @@ public class Blocks implements ContentList{
shots = 2;
size = 4;
shootCone = 24f;
shootSound = Sounds.shootBig;
health = 155 * size * size;
consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 2f)).update(false).optional(true, true);
@@ -1603,6 +1607,9 @@ public class Blocks implements ContentList{
firingMoveFract = 0.5f;
shootDuration = 220f;
powerUse = 14f;
shootSound = Sounds.laserbig;
idleSound = Sounds.beam;
idleSoundVolume = 2f;
health = 200 * size * size;
consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 0.5f)).update(false);

View File

@@ -1,22 +1,18 @@
package io.anuke.mindustry.content;
import io.anuke.arc.Core;
import io.anuke.arc.graphics.Blending;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.TextureRegion;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.entities.Effects;
import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.bullet.BombBulletType;
import io.anuke.mindustry.entities.effect.Lightning;
import io.anuke.mindustry.entities.type.Player;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.graphics.Pal;
import io.anuke.mindustry.graphics.Shaders;
import io.anuke.mindustry.type.Mech;
import io.anuke.mindustry.type.Weapon;
import io.anuke.arc.*;
import io.anuke.arc.graphics.*;
import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.math.*;
import io.anuke.arc.util.*;
import io.anuke.mindustry.entities.*;
import io.anuke.mindustry.entities.bullet.*;
import io.anuke.mindustry.entities.effect.*;
import io.anuke.mindustry.entities.type.*;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.type.*;
public class Mechs implements ContentList{
public static Mech alpha, delta, tau, omega, dart, javelin, trident, glaive;
@@ -79,6 +75,7 @@ public class Mechs implements ContentList{
inaccuracy = 0f;
ejectEffect = Fx.none;
bullet = Bullets.lightning;
shootSound = Sounds.spark;
}};
}
@@ -122,6 +119,7 @@ public class Mechs implements ContentList{
ejectEffect = Fx.none;
recoil = 2f;
bullet = Bullets.healBullet;
shootSound = Sounds.pew;
}};
}
@@ -173,6 +171,7 @@ public class Mechs implements ContentList{
ejectEffect = Fx.none;
shake = 3f;
bullet = Bullets.missileSwarm;
shootSound = Sounds.shootBig;
}};
}
@@ -267,6 +266,7 @@ public class Mechs implements ContentList{
velocityRnd = 0.2f;
spacing = 1f;
bullet = Bullets.missileJavelin;
shootSound = Sounds.missile;
}};
}
@@ -337,6 +337,7 @@ public class Mechs implements ContentList{
hitEffect = Fx.flakExplosion;
shootEffect = Fx.none;
smokeEffect = Fx.none;
shootSound = Sounds.artillery;
}};
}};
}
@@ -366,6 +367,7 @@ public class Mechs implements ContentList{
roundrobin = true;
ejectEffect = Fx.shellEjectSmall;
bullet = Bullets.standardGlaive;
shootSound = Sounds.shootSnap;
}};
}
};

View File

@@ -5,6 +5,7 @@ import io.anuke.mindustry.entities.bullet.*;
import io.anuke.mindustry.entities.type.*;
import io.anuke.mindustry.entities.type.base.*;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.type.*;
public class UnitTypes implements ContentList{
@@ -47,6 +48,7 @@ public class UnitTypes implements ContentList{
ejectEffect = Fx.none;
recoil = 2f;
bullet = Bullets.healBullet;
shootSound = Sounds.pew;
}};
}};
@@ -131,6 +133,7 @@ public class UnitTypes implements ContentList{
health = 460;
immunities.add(StatusEffects.burning);
weapon = new Weapon("flamethrower"){{
shootSound = Sounds.flame;
length = 1f;
reload = 14f;
range = 30f;
@@ -159,6 +162,7 @@ public class UnitTypes implements ContentList{
shake = 2f;
ejectEffect = Fx.shellEjectMedium;
bullet = Bullets.artilleryUnit;
shootSound = Sounds.artillery;
}};
}};
@@ -180,6 +184,7 @@ public class UnitTypes implements ContentList{
bullet = Bullets.eruptorShot;
recoil = 1f;
width = 7f;
shootSound = Sounds.flame;
}};
}};
@@ -203,6 +208,7 @@ public class UnitTypes implements ContentList{
shotDelay = 5;
ejectEffect = Fx.shellEjectMedium;
bullet = Bullets.flakSurge;
shootSound = Sounds.shootBig;
}};
}};
@@ -268,6 +274,7 @@ public class UnitTypes implements ContentList{
inaccuracy = 40f;
ignoreRotation = true;
bullet = Bullets.bombExplosive;
shootSound = Sounds.release;
}};
}};
@@ -297,6 +304,7 @@ public class UnitTypes implements ContentList{
ejectEffect = Fx.none;
velocityRnd = 0.2f;
spacing = 1f;
shootSound = Sounds.missile;
bullet = Bullets.missileRevenant;
}};
}};
@@ -330,6 +338,7 @@ public class UnitTypes implements ContentList{
velocityRnd = 0.2f;
spacing = 1f;
bullet = Bullets.missileRevenant;
shootSound = Sounds.missile;
}};
}};
@@ -360,6 +369,7 @@ public class UnitTypes implements ContentList{
roundrobin = true;
ejectEffect = Fx.none;
bullet = Bullets.standardDenseBig;
shootSound = Sounds.shootBig;
}};
}};
}

View File

@@ -152,6 +152,7 @@ public class Renderer implements ApplicationListener{
try{
if(bloom != null){
bloom.dispose();
bloom = null;
}
bloom = new Bloom(true);
bloom.setClearColor(0f, 0f, 0f, 0f);

View File

@@ -1,9 +1,10 @@
package io.anuke.mindustry.entities.bullet;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.entities.Effects;
import io.anuke.mindustry.entities.Effects.Effect;
import io.anuke.arc.graphics.g2d.*;
import io.anuke.mindustry.content.*;
import io.anuke.mindustry.entities.*;
import io.anuke.mindustry.entities.Effects.*;
import io.anuke.mindustry.gen.*;
//TODO scale velocity depending on fslope()
public class ArtilleryBulletType extends BasicBulletType{
@@ -15,6 +16,7 @@ public class ArtilleryBulletType extends BasicBulletType{
collides = false;
collidesAir = false;
hitShake = 1f;
hitSound = Sounds.explosion;
}
@Override

View File

@@ -1,5 +1,7 @@
package io.anuke.mindustry.entities.bullet;
import io.anuke.mindustry.gen.*;
public class BombBulletType extends BasicBulletType{
public BombBulletType(float damage, float radius, String sprite){
@@ -13,5 +15,6 @@ public class BombBulletType extends BasicBulletType{
drag = 0.05f;
keepVelocity = false;
collidesAir = false;
hitSound = Sounds.explosion;
}
}

View File

@@ -1,18 +1,17 @@
package io.anuke.mindustry.entities.bullet;
import io.anuke.arc.math.Angles;
import io.anuke.arc.math.Mathf;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.content.StatusEffects;
import io.anuke.arc.audio.*;
import io.anuke.arc.math.*;
import io.anuke.mindustry.content.*;
import io.anuke.mindustry.entities.*;
import io.anuke.mindustry.entities.Effects.Effect;
import io.anuke.mindustry.entities.effect.Lightning;
import io.anuke.mindustry.entities.traits.TargetTrait;
import io.anuke.mindustry.game.Content;
import io.anuke.mindustry.graphics.Pal;
import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.StatusEffect;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.entities.Effects.*;
import io.anuke.mindustry.entities.effect.*;
import io.anuke.mindustry.entities.traits.*;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.type.*;
import io.anuke.mindustry.world.*;
public abstract class BulletType extends Content{
public float lifetime;
@@ -28,6 +27,8 @@ public abstract class BulletType extends Content{
public Effect shootEffect = Fx.shootSmall;
/** Extra smoke effect created when shooting. */
public Effect smokeEffect = Fx.shootSmallSmoke;
/** Sound made when hitting something or getting removed.*/
public Sound hitSound = Sounds.none;
/** Extra inaccuracy when firing. */
public float inaccuracy = 0f;
/** How many bullets get created per ammo item/liquid. */
@@ -105,6 +106,7 @@ public abstract class BulletType extends Content{
public void hit(Bullet b, float x, float y){
Effects.effect(hitEffect, x, y, b.rot());
hitSound.at(b);
Effects.shake(hitShake, hitShake, b);
@@ -127,6 +129,7 @@ public abstract class BulletType extends Content{
public void despawned(Bullet b){
Effects.effect(despawnEffect, b.x, b.y, b.rot());
hitSound.at(b);
if(fragBullet != null || splashDamageRadius > 0){
hit(b);

View File

@@ -16,9 +16,8 @@ import io.anuke.mindustry.Vars;
import io.anuke.mindustry.content.*;
import io.anuke.mindustry.entities.*;
import io.anuke.mindustry.entities.traits.*;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.game.TypeID;
import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.Pal;
import io.anuke.mindustry.input.Binding;
import io.anuke.mindustry.input.InputHandler.PlaceDraw;
@@ -71,6 +70,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
private Tile mining;
private Vector2 movement = new Vector2();
private boolean moved;
private SoundLoop sound = new SoundLoop(Sounds.thruster, 2f);
//endregion
@@ -110,6 +110,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
dead = false;
spawner = null;
respawns --;
Sounds.respawn.at(tile);
setNet(tile.drawx(), tile.drawy());
clearItem();
@@ -130,6 +131,11 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
}
}
@Override
public void removed(){
sound.stop();
}
@Override
public float drag(){
return mech.drag;
@@ -507,6 +513,8 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
destructTime = 0f;
}
sound.update(x, y, isBoosting && !isDead() && !mech.flying);
if(isDead()){
isBoosting = false;
boostHeat = 0f;

View File

@@ -383,18 +383,21 @@ public class Bloom{
* Call this when application is exiting.
*/
public void dispose(){
if(disposeFBO)
frameBuffer.dispose();
try{
if(disposeFBO)
frameBuffer.dispose();
fullScreenQuad.dispose();
fullScreenQuad.dispose();
pingPongBuffer1.dispose();
pingPongBuffer2.dispose();
pingPongBuffer1.dispose();
pingPongBuffer2.dispose();
blurShader.dispose();
bloomShader.dispose();
tresholdShader.dispose();
blurShader.dispose();
bloomShader.dispose();
tresholdShader.dispose();
}catch(Exception ignored){
}
}
private static Mesh createFullScreenQuad(){

View File

@@ -62,7 +62,7 @@ public abstract class GenerateFilter{
}
protected float chance(){
return Mathf.randomSeed(Pack.longInt(in.x, in.y + (int)o));
return Mathf.randomSeed(Pack.longInt(in.x, in.y + (int)seed));
}
/** an input for generating at a certain coordinate. should only be instantiated once. */

View File

@@ -104,6 +104,13 @@ public class LaserTurret extends PowerTurret{
return new LaserTurretEntity();
}
@Override
public boolean shouldIdleSound(Tile tile){
LaserTurretEntity entity = tile.entity();
return entity.bulletLife > 0 && entity.bullet != null;
}
class LaserTurretEntity extends TurretEntity{
Bullet bullet;
float bulletLife;

View File

@@ -79,6 +79,7 @@ public abstract class LiquidTurret extends Turret{
Effects.effect(type.shootEffect, entity.liquids.current().color, tile.drawx() + tr.x, tile.drawy() + tr.y, entity.rotation);
Effects.effect(type.smokeEffect, entity.liquids.current().color, tile.drawx() + tr.x, tile.drawy() + tr.y, entity.rotation);
shootSound.at(tile);
if(shootShake > 0){
Effects.shake(shootShake, shootShake, tile.entity);

View File

@@ -30,6 +30,8 @@ public class CoreBlock extends StorageBlock{
update = true;
hasItems = true;
flags = EnumSet.of(BlockFlag.target, BlockFlag.producer);
idleSound = Sounds.respawning;
idleSoundVolume = 1f;
}
@Remote(called = Loc.server)
@@ -152,6 +154,13 @@ public class CoreBlock extends StorageBlock{
}
}
@Override
public boolean shouldIdleSound(Tile tile){
CoreEntity entity = tile.entity();
return entity.spawnPlayer != null;
}
@Override
public TileEntity newEntity(){
return new CoreEntity();