Insect/leg unit step sound

This commit is contained in:
Anuken 2025-11-20 21:06:59 -05:00
parent f14f8eff83
commit 848fcfad1f
7 changed files with 41 additions and 5 deletions

Binary file not shown.

View file

@ -59,8 +59,11 @@ public class SoundPriority{
sound.setMinConcurrentInterrupt(Math.min(0.25f, sound.getLength() * 0.5f));
}
mechStep.setMinConcurrentInterrupt(0.3f);
mechStep.setMaxConcurrent(3);
mechStep.setMinConcurrentInterrupt(0.5f);
walkerStep.setMinConcurrentInterrupt(0.6f);
mechStep.setMaxConcurrent(4);
walkerStep.setMaxConcurrent(4);
}
static void max(int max, Sound... sounds){

View file

@ -551,6 +551,10 @@ public class UnitTypes{
rotateSpeed = 1.5f;
drownTimeMultiplier = 1.6f;
stepSound = Sounds.walkerStep;
stepSoundVolume = 1.1f;
stepSoundPitch = 0.9f;
legCount = 4;
legLength = 14f;
legBaseOffset = 11f;
@ -778,6 +782,10 @@ public class UnitTypes{
legSpeed = 0.2f;
ammoType = new PowerAmmoType(2000);
stepSound = Sounds.walkerStep;
stepSoundVolume = 0.75f;
stepSoundPitch = 1.1f;
legSplashDamage = 32;
legSplashRange = 30;
@ -865,6 +873,8 @@ public class UnitTypes{
health = 22000;
armor = 13f;
lightRadius = 140f;
stepSound = Sounds.walkerStep;
stepSoundVolume = 1.1f;
rotateSpeed = 1.9f;
@ -3375,6 +3385,10 @@ public class UnitTypes{
legMaxLength = 1.3f;
researchCostMultiplier = 0f;
stepSound = Sounds.walkerStep;
stepSoundVolume = 1f;
stepSoundPitch = 1f;
abilities.add(new ShieldArcAbility(){{
region = "tecta-shield";
radius = 45f;
@ -3478,6 +3492,10 @@ public class UnitTypes{
legStraightness = 0.6f;
baseLegStraightness = 0.5f;
stepSound = Sounds.walkerStep;
stepSoundVolume = 1.1f;
stepSoundPitch = 0.9f;
legCount = 8;
legLength = 30f;
legForwardScl = 2.1f;

View file

@ -179,6 +179,7 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Unitc{
floor.walkSound.at(x, y, 1f, floor.walkSoundVolume);
}else{
Fx.unitLandSmall.at(l.base.x, l.base.y, type.rippleScale, floor.mapColor);
type.stepSound.at(l.base.x, l.base.y, type.stepSoundPitch + Mathf.range(0.1f), type.stepSoundVolume);
}
//shake when legs contact ground

View file

@ -51,7 +51,7 @@ abstract class MechComp implements Posc, Hitboxc, Unitc, Mechc, ElevationMovec{
if(type.mechStepParticles){
Effect.floorDust(cx, cy, hitSize/8f);
}
type.stepSound.at(cx, cy, 1f + Mathf.range(0.1f), type.stepSoundVolume);
type.stepSound.at(cx, cy, type.stepSoundPitch + Mathf.range(0.1f), type.stepSoundVolume);
}
walkExtension = extendScl;

View file

@ -460,6 +460,8 @@ public abstract class SaveVersion extends SaveFileReader{
}
public void readWorldEntities(DataInput stream, Prov[] mapping) throws IOException{
IntSet used = new IntSet();
Seq<Entityc> reassign = new Seq<>();
int amount = stream.readInt();
for(int j = 0; j < amount; j++){
@ -476,10 +478,20 @@ public abstract class SaveVersion extends SaveFileReader{
EntityGroup.checkNextId(id);
entity.id(id);
entity.read(in);
entity.add();
if(used.add(id)){
entity.add();
}else{
Log.warn("Duplicate entity ID in save: @ (@)", id, entity);
reassign.add(entity);
}
});
}
for(var ent : reassign){
ent.id(EntityGroup.nextId());
ent.add();
}
Groups.all.each(Entityc::afterReadAll);
}

View file

@ -300,10 +300,12 @@ public class UnitType extends UnlockableContent implements Senseable{
public Sound loopSound = Sounds.none;
/** volume of loop sound */
public float loopSoundVolume = 0.5f;
/** sound played when this mech unit does a step */
/** sound played when this mech/insect unit does a step */
public Sound stepSound = Sounds.none;
/** volume of step sound */
public float stepSoundVolume = 0.5f;
/** base pitch of step sound */
public float stepSoundPitch = 1f;
/** effect that this unit emits when falling */
public Effect fallEffect = Fx.fallSmoke;
/** effect created at engine when unit falls. */