Drill/factory/generator noises

This commit is contained in:
Anuken
2022-08-22 10:27:49 -04:00
parent 57c07b7ebb
commit 450dd90862
10 changed files with 46 additions and 10 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
core/assets/sounds/flux.ogg Normal file

Binary file not shown.

View File

@@ -1155,6 +1155,8 @@ public class Blocks{
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawArcSmelt(), new DrawDefault()); drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawArcSmelt(), new DrawDefault());
fogRadius = 3; fogRadius = 3;
researchCost = with(Items.beryllium, 150, Items.graphite, 50); researchCost = with(Items.beryllium, 150, Items.graphite, 50);
ambientSound = Sounds.smelter;
ambientSoundVolume = 0.12f;
consumeItems(with(Items.graphite, 1, Items.sand, 4)); consumeItems(with(Items.graphite, 1, Items.sand, 4));
consumePower(6f); consumePower(6f);
@@ -1194,6 +1196,9 @@ public class Blocks{
}} }}
); );
ambientSound = Sounds.electricHum;
ambientSoundVolume = 0.08f;
regionRotated1 = 3; regionRotated1 = 3;
outputLiquids = LiquidStack.with(Liquids.ozone, 4f / 60, Liquids.hydrogen, 6f / 60); outputLiquids = LiquidStack.with(Liquids.ozone, 4f / 60, Liquids.hydrogen, 6f / 60);
liquidOutputDirections = new int[]{1, 3}; liquidOutputDirections = new int[]{1, 3};
@@ -1217,6 +1222,8 @@ public class Blocks{
researchCostMultiplier = 1.1f; researchCostMultiplier = 1.1f;
liquidCapacity = 40f; liquidCapacity = 40f;
consumePower(2f); consumePower(2f);
ambientSound = Sounds.extractLoop;
ambientSoundVolume = 0.06f;
heatRequirement = 6f; heatRequirement = 6f;
@@ -1237,6 +1244,8 @@ public class Blocks{
rotateDraw = false; rotateDraw = false;
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidRegion(), new DrawDefault(), new DrawHeatOutput()); drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidRegion(), new DrawDefault(), new DrawHeatOutput());
ambientSound = Sounds.extractLoop;
ambientSoundVolume = 0.08f;
regionRotated1 = 2; regionRotated1 = 2;
craftTime = 60f * 2f; craftTime = 60f * 2f;
@@ -1307,7 +1316,7 @@ public class Blocks{
hasPower = hasItems = true; hasPower = hasItems = true;
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawCrucibleFlame(), new DrawDefault(), new DrawHeatInput()); drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawCrucibleFlame(), new DrawDefault(), new DrawHeatInput());
ambientSound = Sounds.smelter; ambientSound = Sounds.smelter;
ambientSoundVolume = 0.07f; ambientSoundVolume = 0.09f;
heatRequirement = 10f; heatRequirement = 10f;
@@ -1357,7 +1366,7 @@ public class Blocks{
liquidCapacity = 80f * 5; liquidCapacity = 80f * 5;
ambientSound = Sounds.smelter; ambientSound = Sounds.smelter;
ambientSoundVolume = 0.07f; ambientSoundVolume = 0.9f;
outputItem = new ItemStack(Items.surgeAlloy, 1); outputItem = new ItemStack(Items.surgeAlloy, 1);
@@ -1402,6 +1411,9 @@ public class Blocks{
size = 3; size = 3;
ambientSound = Sounds.extractLoop;
ambientSoundVolume = 0.08f;
liquidCapacity = 80f; liquidCapacity = 80f;
outputLiquid = new LiquidStack(Liquids.cyanogen, 3f / 60f); outputLiquid = new LiquidStack(Liquids.cyanogen, 3f / 60f);
@@ -1422,7 +1434,7 @@ public class Blocks{
liquidCapacity = 10f * 4; liquidCapacity = 10f * 4;
ambientSound = Sounds.techloop; ambientSound = Sounds.techloop;
ambientSoundVolume = 0.03f; ambientSoundVolume = 0.04f;
outputItem = new ItemStack(Items.phaseFabric, 1); outputItem = new ItemStack(Items.phaseFabric, 1);
@@ -2498,7 +2510,7 @@ public class Blocks{
ambientSoundVolume = 0.06f; ambientSoundVolume = 0.06f;
}}; }};
//TODO still very much WIP, stats are bad //TODO stats
fluxReactor = new VariableReactor("flux-reactor"){{ fluxReactor = new VariableReactor("flux-reactor"){{
requirements(Category.power, with(Items.graphite, 300, Items.carbide, 200, Items.oxide, 100, Items.silicon, 600, Items.surgeAlloy, 300)); requirements(Category.power, with(Items.graphite, 300, Items.carbide, 200, Items.oxide, 100, Items.silicon, 600, Items.surgeAlloy, 300));
powerProduction = 120f; powerProduction = 120f;
@@ -2508,6 +2520,9 @@ public class Blocks{
liquidCapacity = 30f; liquidCapacity = 30f;
explosionMinWarmup = 0.5f; explosionMinWarmup = 0.5f;
ambientSound = Sounds.flux;
ambientSoundVolume = 0.13f;
size = 5; size = 5;
drawer = new DrawMulti( drawer = new DrawMulti(
@@ -2540,7 +2555,6 @@ public class Blocks{
heatOutput = 60f; heatOutput = 60f;
//TODO arkycite, or nitrogen? both? Decide.
consumeLiquid(Liquids.arkycite, 80f / 60f); consumeLiquid(Liquids.arkycite, 80f / 60f);
consumeLiquid(Liquids.water, 10f / 60f); consumeLiquid(Liquids.water, 10f / 60f);
consumeItem(Items.phaseFabric); consumeItem(Items.phaseFabric);
@@ -2551,11 +2565,14 @@ public class Blocks{
explosionRadius = 5; explosionRadius = 5;
explosionDamage = 500; explosionDamage = 500;
explodeEffect = new MultiEffect(Fx.bigShockwave, new WrapEffect(Fx.titanSmoke, Liquids.neoplasm.color), Fx.neoplasmSplat); explodeEffect = new MultiEffect(Fx.bigShockwave, new WrapEffect(Fx.titanSmoke, Liquids.neoplasm.color), Fx.neoplasmSplat);
explodeSound = Sounds.explosionbig; explodeSound = Sounds.largeExplosion;
powerProduction = 140f; powerProduction = 140f;
rebuildable = false; rebuildable = false;
ambientSound = Sounds.bioLoop;
ambientSoundVolume = 0.2f;
explosionPuddles = 80; explosionPuddles = 80;
explosionPuddleRange = tilesize * 7f; explosionPuddleRange = tilesize * 7f;
explosionPuddleLiquid = Liquids.neoplasm; explosionPuddleLiquid = Liquids.neoplasm;
@@ -2729,7 +2746,6 @@ public class Blocks{
cliffCrusher = new WallCrafter("cliff-crusher"){{ cliffCrusher = new WallCrafter("cliff-crusher"){{
requirements(Category.production, with(Items.graphite, 25, Items.beryllium, 20)); requirements(Category.production, with(Items.graphite, 25, Items.beryllium, 20));
consumePower(11 / 60f); consumePower(11 / 60f);
drillTime = 110f; drillTime = 110f;
@@ -2743,6 +2759,7 @@ public class Blocks{
plasmaBore = new BeamDrill("plasma-bore"){{ plasmaBore = new BeamDrill("plasma-bore"){{
requirements(Category.production, with(Items.beryllium, 40)); requirements(Category.production, with(Items.beryllium, 40));
consumePower(0.15f); consumePower(0.15f);
drillTime = 160f; drillTime = 160f;
tier = 3; tier = 3;
size = 2; size = 2;
@@ -2758,6 +2775,7 @@ public class Blocks{
requirements(Category.production, with(Items.silicon, 100, Items.oxide, 25, Items.beryllium, 100, Items.tungsten, 70)); requirements(Category.production, with(Items.silicon, 100, Items.oxide, 25, Items.beryllium, 100, Items.tungsten, 70));
consumePower(0.8f); consumePower(0.8f);
drillTime = 110f; drillTime = 110f;
tier = 5; tier = 5;
size = 3; size = 3;
range = 6; range = 6;

View File

@@ -5,11 +5,9 @@ import arc.graphics.*;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.math.*; import arc.math.*;
import arc.math.geom.*; import arc.math.geom.*;
import arc.struct.*;
import arc.util.*; import arc.util.*;
import arc.util.io.*; import arc.util.io.*;
import mindustry.annotations.Annotations.*; import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.entities.units.*; import mindustry.entities.units.*;
import mindustry.game.*; import mindustry.game.*;
import mindustry.gen.*; import mindustry.gen.*;
@@ -62,6 +60,8 @@ public class BeamDrill extends Block{
solid = true; solid = true;
drawArrow = false; drawArrow = false;
regionRotated1 = 1; regionRotated1 = 1;
ambientSoundVolume = 0.04f;
ambientSound = Sounds.minebeam;
envEnabled |= Env.space; envEnabled |= Env.space;
} }

View File

@@ -1,5 +1,6 @@
package mindustry.world.blocks.production; package mindustry.world.blocks.production;
import arc.audio.*;
import arc.graphics.*; import arc.graphics.*;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.math.*; import arc.math.*;
@@ -8,6 +9,7 @@ import arc.util.*;
import mindustry.annotations.Annotations.*; import mindustry.annotations.Annotations.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.entities.*; import mindustry.entities.*;
import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.type.*; import mindustry.type.*;
@@ -26,6 +28,9 @@ public class BurstDrill extends Drill{
public Color arrowColor = Color.valueOf("feb380"), baseArrowColor = Color.valueOf("6e7080"); public Color arrowColor = Color.valueOf("feb380"), baseArrowColor = Color.valueOf("6e7080");
public Color glowColor = arrowColor.cpy(); public Color glowColor = arrowColor.cpy();
public Sound drillSound = Sounds.drillImpact;
public float drillSoundVolume = 0.6f, drillSoundPitchRand = 0.1f;
/** Multipliers of drill speed for each item. Defaults to 1. */ /** Multipliers of drill speed for each item. Defaults to 1. */
public ObjectFloatMap<Item> drillMultipliers = new ObjectFloatMap<>(); public ObjectFloatMap<Item> drillMultipliers = new ObjectFloatMap<>();
@@ -38,6 +43,8 @@ public class BurstDrill extends Drill{
//generally at center //generally at center
drillEffectRnd = 0f; drillEffectRnd = 0f;
drillEffect = Fx.shockwave; drillEffect = Fx.shockwave;
ambientSoundVolume = 0.18f;
ambientSound = Sounds.drillCharge;
} }
@Override @Override
@@ -96,11 +103,17 @@ public class BurstDrill extends Drill{
if(wasVisible){ if(wasVisible){
Effect.shake(shake, shake, this); Effect.shake(shake, shake, this);
drillSound.at(x, y, 1f + Mathf.range(drillSoundPitchRand), drillSoundVolume);
drillEffect.at(x + Mathf.range(drillEffectRnd), y + Mathf.range(drillEffectRnd), dominantItem.color); drillEffect.at(x + Mathf.range(drillEffectRnd), y + Mathf.range(drillEffectRnd), dominantItem.color);
} }
} }
} }
@Override
public float ambientVolume(){
return super.ambientVolume() * Mathf.pow(progress(), 4f);
}
@Override @Override
public boolean shouldConsume(){ public boolean shouldConsume(){
return items.total() <= itemCapacity - dominantItems && enabled; return items.total() <= itemCapacity - dominantItems && enabled;

View File

@@ -304,9 +304,14 @@ public class Drill extends Block{
} }
} }
@Override
public float progress(){
return dominantItem == null ? 0f : Mathf.clamp(progress / getDrillTime(dominantItem));
}
@Override @Override
public double sense(LAccess sensor){ public double sense(LAccess sensor){
if(sensor == LAccess.progress && dominantItem != null) return Mathf.clamp(progress / getDrillTime(dominantItem)); if(sensor == LAccess.progress && dominantItem != null) return progress;
return super.sense(sensor); return super.sense(sensor);
} }