diff --git a/core/assets/sounds/walkerStep.ogg b/core/assets/sounds/walkerStep.ogg new file mode 100644 index 0000000000..877b97b7b9 Binary files /dev/null and b/core/assets/sounds/walkerStep.ogg differ diff --git a/core/src/mindustry/audio/SoundPriority.java b/core/src/mindustry/audio/SoundPriority.java index fe8158925c..0c85722278 100644 --- a/core/src/mindustry/audio/SoundPriority.java +++ b/core/src/mindustry/audio/SoundPriority.java @@ -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){ diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index 865896c14f..bd1bb9b715 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -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; diff --git a/core/src/mindustry/entities/comp/LegsComp.java b/core/src/mindustry/entities/comp/LegsComp.java index dbb5c76059..6155ede31e 100644 --- a/core/src/mindustry/entities/comp/LegsComp.java +++ b/core/src/mindustry/entities/comp/LegsComp.java @@ -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 diff --git a/core/src/mindustry/entities/comp/MechComp.java b/core/src/mindustry/entities/comp/MechComp.java index e546b6c166..ce5430fb7c 100644 --- a/core/src/mindustry/entities/comp/MechComp.java +++ b/core/src/mindustry/entities/comp/MechComp.java @@ -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; diff --git a/core/src/mindustry/io/SaveVersion.java b/core/src/mindustry/io/SaveVersion.java index 6973da00fc..4b0c525540 100644 --- a/core/src/mindustry/io/SaveVersion.java +++ b/core/src/mindustry/io/SaveVersion.java @@ -460,6 +460,8 @@ public abstract class SaveVersion extends SaveFileReader{ } public void readWorldEntities(DataInput stream, Prov[] mapping) throws IOException{ + IntSet used = new IntSet(); + Seq 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); } diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 9b09bc9a8d..50b5b1af48 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -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. */