Merge remote-tracking branch 'upstream/master' into unit-stats

This commit is contained in:
Leonwang4234
2020-11-08 15:21:27 -08:00
86 changed files with 260 additions and 210 deletions
+4 -4
View File
@@ -174,14 +174,14 @@ public class Block extends UnlockableContent{
public float lightRadius = 60f;
/** The sound that this block makes while active. One sound loop. Do not overuse.*/
public Sound activeSound = Sounds.none;
public Sound loopSound = Sounds.none;
/** Active sound base volume. */
public float activeSoundVolume = 0.5f;
public float loopSoundVolume = 0.5f;
/** The sound that this block makes while idle. Uses one sound loop for all blocks.*/
public Sound idleSound = Sounds.none;
public Sound ambientSound = Sounds.none;
/** Idle sound base volume. */
public float idleSoundVolume = 0.5f;
public float ambientSoundVolume = 0.05f;
/** Cost of constructing this block. */
public ItemStack[] requirements = {};
@@ -88,6 +88,7 @@ public class ConstructBlock extends Block{
}
Fx.placeBlock.at(tile.drawx(), tile.drawy(), block.size);
if(shouldPlay()) Sounds.place.at(tile, calcPitch(true));
}
static boolean shouldPlay(){
@@ -121,7 +122,6 @@ public class ConstructBlock extends Block{
}
Events.fire(new BlockBuildEndEvent(tile, builder, team, false, config));
if(shouldPlay()) Sounds.place.at(tile, calcPitch(true));
}
@Override
@@ -51,6 +51,8 @@ public class ForceProjector extends Block{
hasPower = true;
hasLiquids = true;
hasItems = true;
ambientSound = Sounds.shield;
ambientSoundVolume = 0.08f;
consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 0.1f)).boost().update(false);
}
@@ -107,6 +109,11 @@ public class ForceProjector extends Block{
drawer.add();
}
@Override
public boolean shouldAmbientSound(){
return !broken && realRadius() > 1f;
}
@Override
public void onRemoved(){
super.onRemoved();
@@ -25,7 +25,7 @@ public class LiquidTurret extends Turret{
super(name);
acceptCoolant = false;
hasLiquids = true;
activeSound = Sounds.spray;
loopSound = Sounds.spray;
}
/** Initializes accepted ammo map. Format: [liquid1, bullet1, liquid2, bullet2...] */
@@ -1,5 +1,6 @@
package mindustry.world.blocks.defense.turrets;
import arc.audio.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
@@ -24,6 +25,8 @@ public class PointDefenseTurret extends ReloadTurret{
public Effect hitEffect = Fx.pointHit;
public Effect shootEffect = Fx.sparkShoot;
public Sound shootSound = Sounds.lasershoot;
public float shootCone = 5f;
public float bulletDamage = 10f;
public float shootLength = 3f;
@@ -90,6 +93,7 @@ public class PointDefenseTurret extends ReloadTurret{
beamEffect.at(x + Tmp.v1.x, y + Tmp.v1.y, rotation, color, new Vec2().set(target));
shootEffect.at(x + Tmp.v1.x, y + Tmp.v1.y, rotation, color);
hitEffect.at(target.x, target.y, color);
shootSound.at(x + Tmp.v1.x, y + Tmp.v1.y, Mathf.random(0.9f, 1.1f));
reload = 0;
}
}else{
@@ -1,5 +1,6 @@
package mindustry.world.blocks.defense.turrets;
import arc.audio.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
@@ -34,6 +35,9 @@ public class TractorBeamTurret extends BaseTurret{
public StatusEffect status = StatusEffects.none;
public float statusDuration = 300;
public Sound shootSound = Sounds.tractorbeam;
public float shootSoundVolume = 0.9f;
public TractorBeamTurret(String name){
super(name);
@@ -91,6 +95,8 @@ public class TractorBeamTurret extends BaseTurret{
//look at target
if(target != null && target.within(this, range) && target.team() != team && target.type.flying && efficiency() > 0.01f){
loops.play(shootSound, this, shootSoundVolume);
any = true;
float dest = angleTo(target);
rotation = Angles.moveToward(rotation, dest, rotateSpeed * edelta());
@@ -50,6 +50,7 @@ public abstract class Turret extends ReloadTurret{
public float recoilAmount = 1f;
public float restitution = 0.02f;
public float cooldown = 0.02f;
public float coolantUsage = 0.2f;
public float shootCone = 8f;
public float shootShake = 0f;
public float xRand = 0f;
@@ -109,7 +110,7 @@ public abstract class Turret extends ReloadTurret{
public void init(){
if(acceptCoolant && !consumes.has(ConsumeType.liquid)){
hasLiquids = true;
consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 0.2f)).update(false).boost();
consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, coolantUsage)).update(false).boost();
}
super.init();
@@ -41,8 +41,8 @@ public class Conveyor extends Block implements Autotiler{
itemCapacity = 4;
conveyorPlacement = true;
idleSound = Sounds.conveyor;
idleSoundVolume = 0.004f;
ambientSound = Sounds.conveyor;
ambientSoundVolume = 0.002f;
unloadable = false;
noUpdateDisabled = false;
}
@@ -161,7 +161,7 @@ public class Conveyor extends Block implements Autotiler{
}
@Override
public boolean shouldIdleSound(){
public boolean shouldAmbientSound(){
return clogHeat <= 0.5f;
}
@@ -44,8 +44,8 @@ public class StackConveyor extends Block implements Autotiler{
itemCapacity = 10;
conveyorPlacement = true;
idleSound = Sounds.conveyor;
idleSoundVolume = 0.004f;
ambientSound = Sounds.conveyor;
ambientSoundVolume = 0.004f;
unloadable = false;
}
@@ -231,7 +231,7 @@ public class StackConveyor extends Block implements Autotiler{
}
@Override
public boolean shouldIdleSound(){
public boolean shouldAmbientSound(){
return false; // has no moving parts;
}
@@ -1,6 +1,7 @@
package mindustry.world.blocks.environment;
import arc.*;
import arc.audio.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.graphics.g2d.TextureAtlas.*;
@@ -10,6 +11,7 @@ import arc.struct.*;
import arc.util.*;
import mindustry.content.*;
import mindustry.entities.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.graphics.MultiPacker.*;
import mindustry.type.*;
@@ -33,7 +35,11 @@ public class Floor extends Block{
/** How many ticks it takes to drown on this. */
public float drownTime = 0f;
/** Effect when walking on this floor. */
public Effect walkEffect = Fx.ripple;
public Effect walkEffect = Fx.none;
/** Sound made when walking. */
public Sound walkSound = Sounds.none;
/** Volume of sound made when walking. */
public float walkSoundVolume = 0.1f, walkSoundPitchMin = 0.8f, walkSoundPitchMax = 1.2f;
/** Effect displayed when drowning on this floor. */
public Effect drownUpdateEffect = Fx.bubble;
/** Status effect applied when walking on. */
@@ -115,6 +121,14 @@ public class Floor extends Block{
if(decoration == Blocks.air){
decoration = content.blocks().min(b -> b instanceof Boulder && b.breakable ? mapColor.diff(b.mapColor) : Float.POSITIVE_INFINITY);
}
if(isLiquid && walkEffect == Fx.none){
walkEffect = Fx.ripple;
}
if(isLiquid && walkSound == Sounds.none){
walkSound = Sounds.splash;
}
}
@Override
@@ -91,6 +91,11 @@ public class ImpactReactor extends PowerGenerator{
productionEfficiency = Mathf.pow(warmup, 5f);
}
@Override
public float ambientVolume(){
return warmup;
}
@Override
public void draw(){
Draw.rect(bottomRegion, x, y);
@@ -66,8 +66,8 @@ public class Drill extends Block{
hasLiquids = true;
liquidCapacity = 5f;
hasItems = true;
idleSound = Sounds.drill;
idleSoundVolume = 0.003f;
ambientSound = Sounds.drill;
ambientSoundVolume = 0.016f;
}
@Override
@@ -205,8 +205,8 @@ public class Drill extends Block{
}
@Override
public boolean shouldIdleSound(){
return efficiency() > 0.01f;
public boolean shouldAmbientSound(){
return efficiency() > 0.01f && items.total() < itemCapacity;
}
@Override
@@ -9,7 +9,6 @@ import mindustry.entities.*;
import mindustry.gen.*;
import mindustry.type.*;
import mindustry.world.*;
import mindustry.world.consumers.*;
import mindustry.world.draw.*;
import mindustry.world.meta.*;
@@ -29,9 +28,9 @@ public class GenericCrafter extends Block{
update = true;
solid = true;
hasItems = true;
idleSound = Sounds.machine;
ambientSound = Sounds.machine;
sync = true;
idleSoundVolume = 0.03f;
ambientSoundVolume = 0.03f;
flags = EnumSet.of(BlockFlag.factory);
}
@@ -137,7 +136,7 @@ public class GenericCrafter extends Block{
}
@Override
public boolean shouldIdleSound(){
public boolean shouldAmbientSound(){
return cons.valid();
}
@@ -5,6 +5,7 @@ import arc.graphics.g2d.*;
import arc.math.*;
import arc.util.*;
import mindustry.annotations.Annotations.*;
import mindustry.gen.*;
import mindustry.graphics.*;
/** A GenericCrafter with a new glowing region drawn on top. */
@@ -14,6 +15,8 @@ public class GenericSmelter extends GenericCrafter{
public GenericSmelter(String name){
super(name);
ambientSound = Sounds.smelter;
ambientSoundVolume = 0.06f;
}
public class SmelterBuild extends GenericCrafterBuild{
@@ -52,7 +52,7 @@ public class Separator extends Block{
public float warmup;
@Override
public boolean shouldIdleSound(){
public boolean shouldAmbientSound(){
return cons.valid();
}
@@ -50,8 +50,8 @@ public class CoreBlock extends StorageBlock{
priority = TargetPriority.core;
flags = EnumSet.of(BlockFlag.core, BlockFlag.unitModifier);
unitCapModifier = 10;
activeSound = Sounds.respawning;
activeSoundVolume = 1f;
loopSound = Sounds.respawning;
loopSoundVolume = 1f;
group = BlockGroup.none;
}