diff --git a/core/assets-raw/sprites/ui/discord-banner.png b/core/assets-raw/sprites/ui/discord-banner.png index 6cb422bc25..7d1a2d4385 100644 Binary files a/core/assets-raw/sprites/ui/discord-banner.png and b/core/assets-raw/sprites/ui/discord-banner.png differ diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 4d988a1bf3..d89bf6a4b2 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -514,6 +514,7 @@ setting.lasers.name = Show Power Lasers setting.pixelate.name = Pixelate[lightgray] (disables animations) setting.minimap.name = Show Minimap setting.musicvol.name = Music Volume +setting.ambientvol.name = Ambient Volume setting.mutemusic.name = Mute Music setting.sfxvol.name = SFX Volume setting.mutesound.name = Mute Sound diff --git a/core/assets/sounds/artillery.ogg b/core/assets/sounds/artillery.ogg index 8debe8b262..d9f8dbd38a 100644 Binary files a/core/assets/sounds/artillery.ogg and b/core/assets/sounds/artillery.ogg differ diff --git a/core/assets/sounds/back.ogg b/core/assets/sounds/back.ogg index 98707d207f..44f6280572 100644 Binary files a/core/assets/sounds/back.ogg and b/core/assets/sounds/back.ogg differ diff --git a/core/assets/sounds/bang.ogg b/core/assets/sounds/bang.ogg index 8debe8b262..31e723b1c9 100644 Binary files a/core/assets/sounds/bang.ogg and b/core/assets/sounds/bang.ogg differ diff --git a/core/assets/sounds/beam.ogg b/core/assets/sounds/beam.ogg index d628942bd1..9e21098e3e 100644 Binary files a/core/assets/sounds/beam.ogg and b/core/assets/sounds/beam.ogg differ diff --git a/core/assets/sounds/bigshot.ogg b/core/assets/sounds/bigshot.ogg index da92f34e54..4e9cf2f675 100644 Binary files a/core/assets/sounds/bigshot.ogg and b/core/assets/sounds/bigshot.ogg differ diff --git a/core/assets/sounds/boom.ogg b/core/assets/sounds/boom.ogg index d024eb74c0..e74d7ada92 100644 Binary files a/core/assets/sounds/boom.ogg and b/core/assets/sounds/boom.ogg differ diff --git a/core/assets/sounds/break.ogg b/core/assets/sounds/break.ogg index 28266f8148..db84b08bc2 100755 Binary files a/core/assets/sounds/break.ogg and b/core/assets/sounds/break.ogg differ diff --git a/core/assets/sounds/build.ogg b/core/assets/sounds/build.ogg index 97155ae9e0..df34ee9823 100644 Binary files a/core/assets/sounds/build.ogg and b/core/assets/sounds/build.ogg differ diff --git a/core/assets/sounds/buttonClick.ogg b/core/assets/sounds/buttonClick.ogg index fb48038764..610f7cdeb7 100755 Binary files a/core/assets/sounds/buttonClick.ogg and b/core/assets/sounds/buttonClick.ogg differ diff --git a/core/assets/sounds/click.ogg b/core/assets/sounds/click.ogg index a993b2cd53..d17d6e6322 100755 Binary files a/core/assets/sounds/click.ogg and b/core/assets/sounds/click.ogg differ diff --git a/core/assets/sounds/corexplode.ogg b/core/assets/sounds/corexplode.ogg index b5c8290481..af4c02ebed 100644 Binary files a/core/assets/sounds/corexplode.ogg and b/core/assets/sounds/corexplode.ogg differ diff --git a/core/assets/sounds/door.ogg b/core/assets/sounds/door.ogg index 30b57f0189..0556a19a47 100755 Binary files a/core/assets/sounds/door.ogg and b/core/assets/sounds/door.ogg differ diff --git a/core/assets/sounds/drill.ogg b/core/assets/sounds/drill.ogg old mode 100755 new mode 100644 index c2c005051e..2ea598c6ff Binary files a/core/assets/sounds/drill.ogg and b/core/assets/sounds/drill.ogg differ diff --git a/core/assets/sounds/empty.ogg b/core/assets/sounds/empty.ogg index 917d0e3611..212bc03189 100644 Binary files a/core/assets/sounds/empty.ogg and b/core/assets/sounds/empty.ogg differ diff --git a/core/assets/sounds/explosion.ogg b/core/assets/sounds/explosion.ogg index b771280848..0d920dc5cc 100644 Binary files a/core/assets/sounds/explosion.ogg and b/core/assets/sounds/explosion.ogg differ diff --git a/core/assets/sounds/explosionbig.ogg b/core/assets/sounds/explosionbig.ogg index b521732f79..c36442948b 100644 Binary files a/core/assets/sounds/explosionbig.ogg and b/core/assets/sounds/explosionbig.ogg differ diff --git a/core/assets/sounds/fire.ogg b/core/assets/sounds/fire.ogg index 2626a9fd7e..55c762b514 100644 Binary files a/core/assets/sounds/fire.ogg and b/core/assets/sounds/fire.ogg differ diff --git a/core/assets/sounds/flame.ogg b/core/assets/sounds/flame.ogg index e8f1a051db..6f89168ecc 100644 Binary files a/core/assets/sounds/flame.ogg and b/core/assets/sounds/flame.ogg differ diff --git a/core/assets/sounds/flame2.ogg b/core/assets/sounds/flame2.ogg index 917d0e3611..9b3282661b 100644 Binary files a/core/assets/sounds/flame2.ogg and b/core/assets/sounds/flame2.ogg differ diff --git a/core/assets/sounds/laser.ogg b/core/assets/sounds/laser.ogg index 3514a627d2..9ae4862a85 100644 Binary files a/core/assets/sounds/laser.ogg and b/core/assets/sounds/laser.ogg differ diff --git a/core/assets/sounds/laserbig.ogg b/core/assets/sounds/laserbig.ogg index 97b4260d49..f0f2b9fdd2 100644 Binary files a/core/assets/sounds/laserbig.ogg and b/core/assets/sounds/laserbig.ogg differ diff --git a/core/assets/sounds/message.ogg b/core/assets/sounds/message.ogg index 84937baf4d..a466296685 100755 Binary files a/core/assets/sounds/message.ogg and b/core/assets/sounds/message.ogg differ diff --git a/core/assets/sounds/missile.ogg b/core/assets/sounds/missile.ogg index 466f610b64..89c7e2b310 100644 Binary files a/core/assets/sounds/missile.ogg and b/core/assets/sounds/missile.ogg differ diff --git a/core/assets/sounds/pew.ogg b/core/assets/sounds/pew.ogg index b26373883d..f31519da5d 100644 Binary files a/core/assets/sounds/pew.ogg and b/core/assets/sounds/pew.ogg differ diff --git a/core/assets/sounds/place.ogg b/core/assets/sounds/place.ogg index 2fca68203c..c7b02a2981 100644 Binary files a/core/assets/sounds/place.ogg and b/core/assets/sounds/place.ogg differ diff --git a/core/assets/sounds/press.ogg b/core/assets/sounds/press.ogg index e52cdb2270..0ba6e71a64 100644 Binary files a/core/assets/sounds/press.ogg and b/core/assets/sounds/press.ogg differ diff --git a/core/assets/sounds/release.ogg b/core/assets/sounds/release.ogg index 865d547ef2..f7c741a2eb 100644 Binary files a/core/assets/sounds/release.ogg and b/core/assets/sounds/release.ogg differ diff --git a/core/assets/sounds/respawn.ogg b/core/assets/sounds/respawn.ogg index 8fbe54ded6..8150b98273 100644 Binary files a/core/assets/sounds/respawn.ogg and b/core/assets/sounds/respawn.ogg differ diff --git a/core/assets/sounds/respawning.ogg b/core/assets/sounds/respawning.ogg index 402b70f89c..de3946833c 100644 Binary files a/core/assets/sounds/respawning.ogg and b/core/assets/sounds/respawning.ogg differ diff --git a/core/assets/sounds/shoot.ogg b/core/assets/sounds/shoot.ogg index c50b9ff90a..3800c683dc 100644 Binary files a/core/assets/sounds/shoot.ogg and b/core/assets/sounds/shoot.ogg differ diff --git a/core/assets/sounds/shootBig.ogg b/core/assets/sounds/shootBig.ogg index ba796b2dfc..d777385a96 100644 Binary files a/core/assets/sounds/shootBig.ogg and b/core/assets/sounds/shootBig.ogg differ diff --git a/core/assets/sounds/shootSnap.ogg b/core/assets/sounds/shootSnap.ogg index c50b9ff90a..b28ba791a3 100644 Binary files a/core/assets/sounds/shootSnap.ogg and b/core/assets/sounds/shootSnap.ogg differ diff --git a/core/assets/sounds/shotgun.ogg b/core/assets/sounds/shotgun.ogg index 5e26f3f1e4..81f9aa24ac 100644 Binary files a/core/assets/sounds/shotgun.ogg and b/core/assets/sounds/shotgun.ogg differ diff --git a/core/assets/sounds/spark.ogg b/core/assets/sounds/spark.ogg index 58fbfb4030..20c96353e0 100644 Binary files a/core/assets/sounds/spark.ogg and b/core/assets/sounds/spark.ogg differ diff --git a/core/assets/sounds/splash.ogg b/core/assets/sounds/splash.ogg index 0ca516e674..be0155f52b 100644 Binary files a/core/assets/sounds/splash.ogg and b/core/assets/sounds/splash.ogg differ diff --git a/core/assets/sounds/thruster.ogg b/core/assets/sounds/thruster.ogg index fad9090768..46c4a2c5fc 100755 Binary files a/core/assets/sounds/thruster.ogg and b/core/assets/sounds/thruster.ogg differ diff --git a/core/assets/sounds/unlock.ogg b/core/assets/sounds/unlock.ogg index 04fe1efae0..d3abf15026 100755 Binary files a/core/assets/sounds/unlock.ogg and b/core/assets/sounds/unlock.ogg differ diff --git a/core/assets/sounds/wave.ogg b/core/assets/sounds/wave.ogg index f5af16677e..638d3afc8f 100644 Binary files a/core/assets/sounds/wave.ogg and b/core/assets/sounds/wave.ogg differ diff --git a/core/assets/sounds/windowHide.ogg b/core/assets/sounds/windowHide.ogg index 92fbd146e8..4c7b40285f 100755 Binary files a/core/assets/sounds/windowHide.ogg and b/core/assets/sounds/windowHide.ogg differ diff --git a/core/assets/sprites/uiskin.json b/core/assets/sprites/uiskin.json index 6ae168744c..30e049a889 100644 --- a/core/assets/sprites/uiskin.json +++ b/core/assets/sprites/uiskin.json @@ -132,11 +132,6 @@ fontColor: white, up: info-banner }, - discord: { - font: default, - fontColor: white, - up: info-banner - }, clear-partial: { down: whiteui, up: pane, diff --git a/core/src/io/anuke/mindustry/Vars.java b/core/src/io/anuke/mindustry/Vars.java index 183eb56a0c..f995df588b 100644 --- a/core/src/io/anuke/mindustry/Vars.java +++ b/core/src/io/anuke/mindustry/Vars.java @@ -133,6 +133,7 @@ public class Vars{ public static GlobalData data; public static EntityCollisions collisions; public static DefaultWaves defaultWaves; + public static LoopControl loops; public static Control control; public static Logic logic; @@ -181,6 +182,7 @@ public class Vars{ content.setVerbose(); } + loops = new LoopControl(); defaultWaves = new DefaultWaves(); collisions = new EntityCollisions(); diff --git a/core/src/io/anuke/mindustry/content/Blocks.java b/core/src/io/anuke/mindustry/content/Blocks.java index 6d2ec8615c..cf947b02e7 100644 --- a/core/src/io/anuke/mindustry/content/Blocks.java +++ b/core/src/io/anuke/mindustry/content/Blocks.java @@ -1608,8 +1608,8 @@ public class Blocks implements ContentList{ shootDuration = 220f; powerUse = 14f; shootSound = Sounds.laserbig; - idleSound = Sounds.beam; - idleSoundVolume = 2f; + activeSound = Sounds.beam; + activeSoundVolume = 2f; health = 200 * size * size; consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 0.5f)).update(false); diff --git a/core/src/io/anuke/mindustry/core/Control.java b/core/src/io/anuke/mindustry/core/Control.java index 55629d837f..b0e2eed073 100644 --- a/core/src/io/anuke/mindustry/core/Control.java +++ b/core/src/io/anuke/mindustry/core/Control.java @@ -392,6 +392,7 @@ public class Control implements ApplicationListener{ data.checkSave(); music.update(); + loops.update(); if(!state.is(State.menu)){ input.update(); @@ -415,7 +416,7 @@ public class Control implements ApplicationListener{ Platform.instance.updateRPC(); } - if(Core.input.keyTap(Binding.pause) && !ui.restart.isShown() && (state.is(State.paused) || state.is(State.playing))){ + if(Core.input.keyTap(Binding.pause) && !scene.hasDialog() && !ui.restart.isShown() && (state.is(State.paused) || state.is(State.playing))){ state.set(state.is(State.playing) ? State.paused : State.playing); } diff --git a/core/src/io/anuke/mindustry/entities/type/TileEntity.java b/core/src/io/anuke/mindustry/entities/type/TileEntity.java index 2c442a00a4..ce9af0012b 100644 --- a/core/src/io/anuke/mindustry/entities/type/TileEntity.java +++ b/core/src/io/anuke/mindustry/entities/type/TileEntity.java @@ -20,8 +20,7 @@ import io.anuke.mindustry.world.modules.*; import java.io.*; -import static io.anuke.mindustry.Vars.tileGroup; -import static io.anuke.mindustry.Vars.world; +import static io.anuke.mindustry.Vars.*; public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{ public static final float timeToSleep = 60f * 4; //4 seconds to fall asleep @@ -70,8 +69,8 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{ x = tile.drawx(); y = tile.drawy(); block = tile.block(); - if(block.idleSound != Sounds.none){ - sound = new SoundLoop(block.idleSound, block.idleSoundVolume); + if(block.activeSound != Sounds.none){ + sound = new SoundLoop(block.activeSound, block.activeSoundVolume); } health = block.health; @@ -298,7 +297,11 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{ } if(sound != null){ - sound.update(x, y, block.shouldIdleSound(tile)); + sound.update(x, y, block.shouldActiveSound(tile)); + } + + if(block.idleSound != Sounds.none && block.shouldIdleSound(tile)){ + loops.play(block.idleSound, this, block.idleSoundVolume); } Block previous = block; diff --git a/core/src/io/anuke/mindustry/game/LoopControl.java b/core/src/io/anuke/mindustry/game/LoopControl.java new file mode 100644 index 0000000000..e6b7dffae2 --- /dev/null +++ b/core/src/io/anuke/mindustry/game/LoopControl.java @@ -0,0 +1,63 @@ +package io.anuke.mindustry.game; + +import io.anuke.arc.*; +import io.anuke.arc.audio.*; +import io.anuke.arc.collection.*; +import io.anuke.arc.math.*; +import io.anuke.arc.math.geom.*; +import io.anuke.mindustry.*; + +public class LoopControl{ + private ObjectMap sounds = new ObjectMap<>(); + + public void play(Sound sound, Position pos, float volume){ + if(Vars.headless) return; + + float baseVol = sound.calcFalloff(pos.getX(), pos.getY()); + float vol = baseVol * volume; + + SoundData data = sounds.getOr(sound, SoundData::new); + data.volume += vol; + data.volume = Mathf.clamp(data.volume, 0f, 1f); + data.total += baseVol; + data.sum.add(pos.getX() * baseVol, pos.getY() * baseVol); + } + + public void update(){ + float avol = Core.settings.getInt("ambientvol", 100) / 100f; + + sounds.each((sound, data) -> { + data.curVolume = Mathf.lerpDelta(data.curVolume, data.volume * avol, 0.2f); + + boolean play = data.curVolume > 0.01f; + float pan = Mathf.isZero(data.total, 0.0001f) ? 0f : sound.calcPan(data.sum.x / data.total, data.sum.y / data.total); + //Log.info(pan); + //TODO calc pan + if(data.soundID <= 0){ + if(play){ + data.soundID = sound.loop(data.curVolume, 1f, pan); + } + }else{ + if(data.curVolume <= 0.01f){ + sound.stop(data.soundID); + data.soundID = -1; + return; + } + sound.setPan(data.soundID, pan, data.curVolume); + } + + data.volume = 0f; + data.total = 0f; + data.sum.setZero(); + }); + } + + private class SoundData{ + float volume; + float total; + Vector2 sum = new Vector2(); + + int soundID; + float curVolume; + } +} diff --git a/core/src/io/anuke/mindustry/game/SoundControl.java b/core/src/io/anuke/mindustry/game/SoundControl.java deleted file mode 100644 index 89afd3e5cd..0000000000 --- a/core/src/io/anuke/mindustry/game/SoundControl.java +++ /dev/null @@ -1,4 +0,0 @@ -package io.anuke.mindustry.game; - -public class SoundControl{ -} diff --git a/core/src/io/anuke/mindustry/ui/MultiReqImage.java b/core/src/io/anuke/mindustry/ui/MultiReqImage.java index 41c9ef2e44..4fa2cf2fc8 100644 --- a/core/src/io/anuke/mindustry/ui/MultiReqImage.java +++ b/core/src/io/anuke/mindustry/ui/MultiReqImage.java @@ -25,7 +25,9 @@ public class MultiReqImage extends Stack{ if(valid != null){ valid.visible(true); }else{ - displays.get((int)(time) % displays.size).visible(true); + if(displays.size > 0){ + displays.get((int)(time) % displays.size).visible(true); + } } } } diff --git a/core/src/io/anuke/mindustry/ui/dialogs/SettingsMenuDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/SettingsMenuDialog.java index 84c429ed0e..19fbf6a4d3 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/SettingsMenuDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/SettingsMenuDialog.java @@ -126,6 +126,7 @@ public class SettingsMenuDialog extends SettingsDialog{ void addSettings(){ sound.sliderPref("musicvol", bundle.get("setting.musicvol.name", "Music Volume"), 100, 0, 100, 1, i -> i + "%"); sound.sliderPref("sfxvol", bundle.get("setting.sfxvol.name", "SFX Volume"), 100, 0, 100, 1, i -> i + "%"); + sound.sliderPref("ambientvol", bundle.get("setting.ambientvol.name", "Ambient Volume"), 100, 0, 100, 1, i -> i + "%"); game.screenshakePref(); if(mobile){ diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index bbf58ef453..577d40771e 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -101,7 +101,13 @@ public class Block extends BlockStorage{ public boolean hasShadow = true; /** Sounds made when this block breaks.*/ public Sound breakSound = Sounds.boom; - /** The sound that this block makes while active.*/ + + /** The sound that this block makes while active. One sound loop. Do not overuse.*/ + public Sound activeSound = Sounds.none; + /** Active sound base volume. */ + public float activeSoundVolume = 0.5f; + + /** The sound that this block makes while idle. Uses one sound loop for all blocks.*/ public Sound idleSound = Sounds.none; /** Idle sound base volume. */ public float idleSoundVolume = 0.5f; @@ -212,6 +218,11 @@ public class Block extends BlockStorage{ return progressIncrease; } + /** @return whether this block should play its active sound.*/ + public boolean shouldActiveSound(Tile tile){ + return false; + } + /** @return whether this block should play its idle sound.*/ public boolean shouldIdleSound(Tile tile){ return canProduce(tile); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LaserTurret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LaserTurret.java index ecaba6b3b5..3c283e877b 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LaserTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LaserTurret.java @@ -105,7 +105,7 @@ public class LaserTurret extends PowerTurret{ } @Override - public boolean shouldIdleSound(Tile tile){ + public boolean shouldActiveSound(Tile tile){ LaserTurretEntity entity = tile.entity(); return entity.bulletLife > 0 && entity.bullet != null; diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LiquidTurret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LiquidTurret.java index 1b6f59d41c..4cbcb4a680 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LiquidTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LiquidTurret.java @@ -5,6 +5,7 @@ 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.gen.*; import io.anuke.mindustry.type.*; import io.anuke.mindustry.world.*; import io.anuke.mindustry.world.consumers.*; @@ -19,6 +20,7 @@ public abstract class LiquidTurret extends Turret{ public LiquidTurret(String name){ super(name); hasLiquids = true; + activeSound = Sounds.spray; } /** Initializes accepted ammo map. Format: [liquid1, bullet1, liquid2, bullet2...] */ @@ -44,6 +46,12 @@ public abstract class LiquidTurret extends Turret{ }); } + @Override + public boolean shouldActiveSound(Tile tile){ + TurretEntity entity = tile.entity(); + return entity.target != null && hasAmmo(tile); + } + @Override protected boolean validateTarget(Tile tile){ TurretEntity entity = tile.entity(); @@ -79,7 +87,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); + //shootSound.at(tile); if(shootShake > 0){ Effects.shake(shootShake, shootShake, tile.entity); diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java b/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java index a2cbf90315..de6c98d3e3 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java @@ -1,19 +1,17 @@ package io.anuke.mindustry.world.blocks.distribution; -import io.anuke.arc.Core; -import io.anuke.arc.collection.LongArray; -import io.anuke.arc.graphics.g2d.Draw; -import io.anuke.arc.graphics.g2d.TextureRegion; -import io.anuke.arc.math.Mathf; +import io.anuke.arc.*; +import io.anuke.arc.collection.*; +import io.anuke.arc.graphics.g2d.*; +import io.anuke.arc.math.*; import io.anuke.arc.math.geom.*; import io.anuke.arc.util.*; -import io.anuke.mindustry.entities.type.TileEntity; -import io.anuke.mindustry.entities.type.Unit; -import io.anuke.mindustry.graphics.Layer; -import io.anuke.mindustry.input.InputHandler.PlaceDraw; -import io.anuke.mindustry.type.Item; -import io.anuke.mindustry.world.Block; -import io.anuke.mindustry.world.Tile; +import io.anuke.mindustry.entities.type.*; +import io.anuke.mindustry.gen.*; +import io.anuke.mindustry.graphics.*; +import io.anuke.mindustry.input.InputHandler.*; +import io.anuke.mindustry.type.*; +import io.anuke.mindustry.world.*; import io.anuke.mindustry.world.meta.*; import java.io.*; @@ -41,6 +39,9 @@ public class Conveyor extends Block{ group = BlockGroup.transportation; hasItems = true; itemCapacity = 4; + + idleSound = Sounds.conveyor; + idleSoundVolume = 0.004f; } private static int compareItems(long a, long b){ @@ -76,6 +77,12 @@ public class Conveyor extends Block{ tilesize * entity.blendsclx, tilesize * entity.blendscly, rotation * 90); } + @Override + public boolean shouldIdleSound(Tile tile){ + ConveyorEntity entity = tile.entity(); + return entity.clogHeat <= 0.5f ; + } + @Override public void onProximityUpdate(Tile tile){ super.onProximityUpdate(tile); diff --git a/core/src/io/anuke/mindustry/world/blocks/production/Drill.java b/core/src/io/anuke/mindustry/world/blocks/production/Drill.java index 60ea278080..d8f4551c20 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/Drill.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/Drill.java @@ -10,6 +10,7 @@ import io.anuke.mindustry.content.*; import io.anuke.mindustry.entities.*; import io.anuke.mindustry.entities.Effects.*; import io.anuke.mindustry.entities.type.*; +import io.anuke.mindustry.gen.*; import io.anuke.mindustry.graphics.*; import io.anuke.mindustry.type.*; import io.anuke.mindustry.ui.*; @@ -65,8 +66,8 @@ public class Drill extends Block{ liquidCapacity = 5f; hasItems = true; - //idleSound = Sounds.drill; - //idleSoundVolume = 0.5f; + idleSound = Sounds.drill; + idleSoundVolume = 0.004f; } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/production/GenericCrafter.java b/core/src/io/anuke/mindustry/world/blocks/production/GenericCrafter.java index 661b007331..428697d853 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/GenericCrafter.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/GenericCrafter.java @@ -1,21 +1,18 @@ package io.anuke.mindustry.world.blocks.production; -import io.anuke.arc.function.Consumer; -import io.anuke.arc.function.Supplier; -import io.anuke.arc.graphics.g2d.TextureRegion; -import io.anuke.arc.math.Mathf; -import io.anuke.arc.util.Time; -import io.anuke.mindustry.content.Fx; -import io.anuke.mindustry.entities.Effects; -import io.anuke.mindustry.entities.Effects.Effect; -import io.anuke.mindustry.entities.type.TileEntity; +import io.anuke.arc.function.*; +import io.anuke.arc.graphics.g2d.*; +import io.anuke.arc.math.*; +import io.anuke.arc.util.*; +import io.anuke.mindustry.content.*; +import io.anuke.mindustry.entities.*; +import io.anuke.mindustry.entities.Effects.*; +import io.anuke.mindustry.entities.type.*; +import io.anuke.mindustry.gen.*; import io.anuke.mindustry.type.*; -import io.anuke.mindustry.world.Block; -import io.anuke.mindustry.world.Tile; -import io.anuke.mindustry.world.consumers.ConsumeLiquidBase; -import io.anuke.mindustry.world.consumers.ConsumeType; -import io.anuke.mindustry.world.meta.BlockStat; -import io.anuke.mindustry.world.meta.StatUnit; +import io.anuke.mindustry.world.*; +import io.anuke.mindustry.world.consumers.*; +import io.anuke.mindustry.world.meta.*; import java.io.*; @@ -37,6 +34,8 @@ public class GenericCrafter extends Block{ solid = true; hasItems = true; health = 60; + idleSound = Sounds.machine; + idleSoundVolume = 0.03f; } @Override @@ -58,6 +57,11 @@ public class GenericCrafter extends Block{ } } + @Override + public boolean shouldIdleSound(Tile tile){ + return tile.entity.cons.valid(); + } + @Override public void init(){ outputsLiquid = outputLiquid != null; diff --git a/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java b/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java index 7b4355eb5e..b4f02e1fc0 100644 --- a/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java @@ -30,8 +30,8 @@ public class CoreBlock extends StorageBlock{ update = true; hasItems = true; flags = EnumSet.of(BlockFlag.target, BlockFlag.producer); - idleSound = Sounds.respawning; - idleSoundVolume = 1f; + activeSound = Sounds.respawning; + activeSoundVolume = 1f; } @Remote(called = Loc.server) @@ -156,7 +156,7 @@ public class CoreBlock extends StorageBlock{ } @Override - public boolean shouldIdleSound(Tile tile){ + public boolean shouldActiveSound(Tile tile){ CoreEntity entity = tile.entity(); return entity.spawnPlayer != null; diff --git a/server/server_template/run_server.bat b/server/server_template/run_server.bat index 64cc23a20c..26d919a77b 100644 --- a/server/server_template/run_server.bat +++ b/server/server_template/run_server.bat @@ -1,5 +1 @@ -@Echo Off -Set "JV=" -For /F "Tokens=3" %%A In ('java -version 2^>^&1') Do If Not Defined JV Set "JV=%%~A" -If /I "%JV%"=="not" (Echo Java is not installed, this server requires Java to run.) Else (start java -jar server.jar) -Pause +java -jar server.jar \ No newline at end of file