New unit death, wreck and creation noises

This commit is contained in:
Anuken
2025-12-08 19:30:09 -05:00
parent 6d2b324f81
commit cae67b7897
19 changed files with 50 additions and 5 deletions

View File

@@ -184,6 +184,7 @@ public class AssetsProcess extends BaseProcessor{
if(classname.equals("Sounds")){ if(classname.equals("Sounds")){
type.addField(FieldSpec.builder(ClassName.bestGuess(rtype), "none", Modifier.STATIC, Modifier.PUBLIC).initializer("new " + rtype + "()").build()); type.addField(FieldSpec.builder(ClassName.bestGuess(rtype), "none", Modifier.STATIC, Modifier.PUBLIC).initializer("new " + rtype + "()").build());
type.addField(FieldSpec.builder(ClassName.bestGuess(rtype), "unset", Modifier.STATIC, Modifier.PUBLIC).initializer("new " + rtype + "()").build());
} }
type.addMethod(loadBegin.build()); type.addMethod(loadBegin.build());

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -6253,6 +6253,7 @@ public class Blocks{
consumePower(13f); consumePower(13f);
consumeItems(with(Items.silicon, 850, Items.titanium, 750, Items.plastanium, 650)); consumeItems(with(Items.silicon, 850, Items.titanium, 750, Items.plastanium, 650));
consumeLiquid(Liquids.cryofluid, 1f); consumeLiquid(Liquids.cryofluid, 1f);
createSound = Sounds.unitCreateBig;
constructTime = 60f * 60f * 1.5f; constructTime = 60f * 60f * 1.5f;
liquidCapacity = 60f; liquidCapacity = 60f;
@@ -6278,6 +6279,7 @@ public class Blocks{
constructTime = 60f * 60f * 4; constructTime = 60f * 60f * 4;
liquidCapacity = 180f; liquidCapacity = 180f;
createSound = Sounds.unitCreateBig;
upgrades.addAll( upgrades.addAll(
new UnitType[]{UnitTypes.antumbra, UnitTypes.eclipse}, new UnitType[]{UnitTypes.antumbra, UnitTypes.eclipse},

View File

@@ -1037,6 +1037,7 @@ public class UnitTypes{
omniMovement = false; omniMovement = false;
rotateSpeed = 5f; rotateSpeed = 5f;
circleTargetRadius = 60f; circleTargetRadius = 60f;
wreckSoundVolume = 0.7f;
weapons.add(new Weapon(){{ weapons.add(new Weapon(){{
y = 1f; y = 1f;
@@ -1323,6 +1324,7 @@ public class UnitTypes{
range = 50f; range = 50f;
isEnemy = false; isEnemy = false;
controlSelectGlobal = false; controlSelectGlobal = false;
wreckSoundVolume = deathSoundVolume = 0.7f;
ammoType = new PowerAmmoType(500); ammoType = new PowerAmmoType(500);
@@ -1348,6 +1350,7 @@ public class UnitTypes{
ammoType = new PowerAmmoType(900); ammoType = new PowerAmmoType(900);
mineTier = 2; mineTier = 2;
mineSpeed = 3.5f; mineSpeed = 3.5f;
wreckSoundVolume = 0.9f;
abilities.add(new RepairFieldAbility(5f, 60f * 8, 50f)); abilities.add(new RepairFieldAbility(5f, 60f * 8, 50f));
@@ -2445,6 +2448,8 @@ public class UnitTypes{
engineOffset = 6f; engineOffset = 6f;
hitSize = 8f; hitSize = 8f;
alwaysUnlocked = true; alwaysUnlocked = true;
wreckSoundVolume = 0.8f;
deathSoundVolume = 0.7f;
weapons.add(new Weapon("small-basic-weapon"){{ weapons.add(new Weapon("small-basic-weapon"){{
reload = 17f; reload = 17f;

View File

@@ -854,7 +854,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
Effect.scorch(x, y, (int)(hitSize / 5)); Effect.scorch(x, y, (int)(hitSize / 5));
} }
Effect.shake(shake, shake, this); Effect.shake(shake, shake, this);
type.deathSound.at(this); type.deathSound.at(this, 1f, type.deathSoundVolume);
Events.fire(new UnitDestroyEvent(self())); Events.fire(new UnitDestroyEvent(self()));
@@ -935,6 +935,8 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
//don't waste time when the unit is already on the ground, just destroy it //don't waste time when the unit is already on the ground, just destroy it
if(!type.flying || !type.createWreck){ if(!type.flying || !type.createWreck){
destroy(); destroy();
}else{
type.wreckSound.at(this, 1f, type.wreckSoundVolume);
} }
} }

View File

@@ -380,7 +380,7 @@ public class AIController implements UnitController{
if(arrive && length > 0){ if(arrive && length > 0){
Tmp.v3.set(-unit.vel.x / unit.type.accel * 2f, -unit.vel.y / unit.type.accel * 2f).add((target.getX() - unit.x), (target.getY() - unit.y)); Tmp.v3.set(-unit.vel.x / unit.type.accel * 2f, -unit.vel.y / unit.type.accel * 2f).add((target.getX() - unit.x), (target.getY() - unit.y));
if(unit.type.omniMovement){ if(unit.type.omniMovement || unit.type.rotateMoveFirst){
vec.add(Tmp.v3).limit(speed * length); vec.add(Tmp.v3).limit(speed * length);
}else{ }else{
//directly move the unit to prevent a backwards movement vector from messing things up //directly move the unit to prevent a backwards movement vector from messing things up

View File

@@ -295,7 +295,13 @@ public class UnitType extends UnlockableContent implements Senseable{
/** override for unit shield colour. */ /** override for unit shield colour. */
public @Nullable Color shieldColor; public @Nullable Color shieldColor;
/** sound played when this unit explodes (*not* when it is shot down) */ /** sound played when this unit explodes (*not* when it is shot down) */
public Sound deathSound = Sounds.bang; public Sound deathSound = Sounds.unset;
/** volume of death sound */
public float deathSoundVolume = 1f;
/** sound played when the unit wreck is shot down */
public Sound wreckSound = Sounds.unset;
/** volume of wreck falling sound */
public float wreckSoundVolume = 1f;
/** sound played on loop when this unit is around. */ /** sound played on loop when this unit is around. */
public Sound loopSound = Sounds.none; public Sound loopSound = Sounds.none;
/** volume of loop sound */ /** volume of loop sound */
@@ -897,6 +903,17 @@ public class UnitType extends UnlockableContent implements Senseable{
envEnabled |= Env.space; envEnabled |= Env.space;
} }
if(deathSound == Sounds.unset){
deathSound =
hitSize < 12f ? Sounds.unitExplode1 :
hitSize < 22f ? Sounds.unitExplode2 :
Sounds.unitExplode3;
}
if(wreckSound == Sounds.unset){
wreckSound = hitSize >= 22f ? Sounds.wreckFallBig : Sounds.wreckFall;
}
if(lightRadius == -1){ if(lightRadius == -1){
lightRadius = Math.max(60f, hitSize * 2.3f); lightRadius = Math.max(60f, hitSize * 2.3f);
} }

View File

@@ -9,7 +9,7 @@ import mindustry.graphics.*;
public class PayloadVoid extends PayloadBlock{ public class PayloadVoid extends PayloadBlock{
public Effect incinerateEffect = Fx.blastExplosion; public Effect incinerateEffect = Fx.blastExplosion;
public Sound incinerateSound = Sounds.bang; public Sound incinerateSound = Sounds.unitExplode1;
public PayloadVoid(String name){ public PayloadVoid(String name){
super(name); super(name);

View File

@@ -3,6 +3,7 @@ package mindustry.world.blocks.units;
import arc.*; import arc.*;
import arc.Graphics.*; import arc.Graphics.*;
import arc.Graphics.Cursor.*; import arc.Graphics.Cursor.*;
import arc.audio.*;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.math.*; import arc.math.*;
import arc.math.geom.*; import arc.math.geom.*;
@@ -34,6 +35,9 @@ public class Reconstructor extends UnitBlock{
public Seq<UnitType[]> upgrades = new Seq<>(); public Seq<UnitType[]> upgrades = new Seq<>();
public int[] capacities = {}; public int[] capacities = {};
public Sound createSound = Sounds.unitCreate;
public float createSoundVolume = 1f;
public Reconstructor(String name){ public Reconstructor(String name){
super(name); super(name);
regionRotated1 = 1; regionRotated1 = 1;
@@ -324,6 +328,7 @@ public class Reconstructor extends UnitBlock{
payload.unit.command().command(command == null && payload.unit.type.defaultCommand != null ? payload.unit.type.defaultCommand : command); payload.unit.command().command(command == null && payload.unit.type.defaultCommand != null ? payload.unit.type.defaultCommand : command);
} }
createSound.at(this, 1f + Mathf.range(0.06f), createSoundVolume);
progress %= 1f; progress %= 1f;
Effect.shake(2f, 3f, this); Effect.shake(2f, 3f, this);
Fx.producesmoke.at(this); Fx.producesmoke.at(this);

View File

@@ -1,6 +1,7 @@
package mindustry.world.blocks.units; package mindustry.world.blocks.units;
import arc.*; import arc.*;
import arc.audio.*;
import arc.graphics.*; import arc.graphics.*;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.math.*; import arc.math.*;
@@ -45,6 +46,9 @@ public class UnitAssembler extends PayloadBlock{
public Seq<AssemblerUnitPlan> plans = new Seq<>(4); public Seq<AssemblerUnitPlan> plans = new Seq<>(4);
public Sound createSound = Sounds.unitCreateBig;
public float createSoundVolume = 1f;
protected @Nullable ConsumePayloadDynamic consPayload; protected @Nullable ConsumePayloadDynamic consPayload;
protected @Nullable ConsumeItemDynamic consItem; protected @Nullable ConsumeItemDynamic consItem;
@@ -60,6 +64,8 @@ public class UnitAssembler extends PayloadBlock{
group = BlockGroup.units; group = BlockGroup.units;
commandable = true; commandable = true;
quickRotate = false; quickRotate = false;
ambientSound = Sounds.respawning;
ambientSoundVolume = 0.13f;
} }
public Rect getRect(Rect rect, float x, float y, int rotation){ public Rect getRect(Rect rect, float x, float y, int rotation){
@@ -536,8 +542,10 @@ public class UnitAssembler extends PayloadBlock{
Units.notifyUnitSpawn(unit); Units.notifyUnitSpawn(unit);
} }
createSound.at(spawn.x, spawn.y, 1f + Mathf.range(0.06f), createSoundVolume);
progress = 0f; progress = 0f;
Fx.unitAssemble.at(spawn.x, spawn.y, 0f, plan.unit); Fx.unitAssemble.at(spawn.x, spawn.y, rotdeg() - 90f, plan.unit);
blocks.clear(); blocks.clear();
} }
@@ -662,6 +670,7 @@ public class UnitAssembler extends PayloadBlock{
float rot = payload.angleTo(spawn); float rot = payload.angleTo(spawn);
Fx.shootPayloadDriver.at(payload.x(), payload.y(), rot); Fx.shootPayloadDriver.at(payload.x(), payload.y(), rot);
Fx.payloadDeposit.at(payload.x(), payload.y(), rot, new YeetData(spawn.cpy(), payload.content())); Fx.payloadDeposit.at(payload.x(), payload.y(), rot, new YeetData(spawn.cpy(), payload.content()));
Sounds.shootPayload.at(x, y, 1f + Mathf.range(0.1f), 1f);
} }
@Override @Override

View File

@@ -1,6 +1,7 @@
package mindustry.world.blocks.units; package mindustry.world.blocks.units;
import arc.*; import arc.*;
import arc.audio.*;
import arc.graphics.*; import arc.graphics.*;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.math.*; import arc.math.*;
@@ -34,6 +35,8 @@ public class UnitFactory extends UnitBlock{
public int[] capacities = {}; public int[] capacities = {};
public Seq<UnitPlan> plans = new Seq<>(4); public Seq<UnitPlan> plans = new Seq<>(4);
public Sound createSound = Sounds.unitCreate;
public float createSoundVolume = 1f;
public UnitFactory(String name){ public UnitFactory(String name){
super(name); super(name);
@@ -417,6 +420,7 @@ public class UnitFactory extends UnitBlock{
unit.command().command(command == null && unit.type.defaultCommand != null ? unit.type.defaultCommand : command); unit.command().command(command == null && unit.type.defaultCommand != null ? unit.type.defaultCommand : command);
} }
createSound.at(this, 1f + Mathf.range(0.06f), createSoundVolume);
payload = new UnitPayload(unit); payload = new UnitPayload(unit);
payVector.setZero(); payVector.setZero();
consume(); consume();