Commit ba65bed3c56f8ac3337dd1ad8e1d29249c2112ad

Authored by DarkGod
2 parents 705353dd 8466bfbf

Merge branch 'reduce_sound_dup' into 'master'

Reduce the volume of duplicated sounds in a single turn

It might be too loud and annoying

See merge request !793
... ... @@ -2939,6 +2939,12 @@ function _M:playSoundNear(who, name)
2939 2939 if who and (not who.attr or not who:attr("_forbid_sounds")) and self.level and self.level.map.seens(who.x, who.y) then
2940 2940 local pos = {x=0,y=0,z=0}
2941 2941 if self.player and self.player.x then pos.x, pos.y = who.x - self.player.x, who.y - self.player.y end
  2942 + if who.turn_procs and type(name) == "string" then
  2943 + who.turn_procs.sounds = who.turn_procs.sounds or {}
  2944 + who.turn_procs.sounds[name] = (who.turn_procs.sounds[name] or 0) + 1
  2945 + local time = who.turn_procs.sounds[name]
  2946 + name = { name, vol = math.min(1, 1 / (2^ (time - 2))) }
  2947 + end
2942 2948 self:playSound(name, pos)
2943 2949 end
2944 2950 end
... ...
... ... @@ -233,8 +233,8 @@ newTalent{
233 233 self:project(tg, a.x, a.y, DamageType.LIGHTNING_DAZE, {dam=rng.avg(1, self:spellCrit(t.getDamage(self, t)), 3), daze=(self:attr("lightning_daze_tempest") or 0) / 2, power_check=self:combatSpellpower()})
234 234 if core.shader.active() then game.level.map:particleEmitter(a.x, a.y, tg.radius, "ball_lightning_beam", {radius=tg.radius, tx=x, ty=y}, {type="lightning"})
235 235 else game.level.map:particleEmitter(a.x, a.y, tg.radius, "ball_lightning_beam", {radius=tg.radius, tx=x, ty=y}) end
236   - game:playSoundNear(self, "talents/lightning")
237 236 end
  237 + game:playSoundNear(self, "talents/lightning")
238 238 end,
239 239 activate = function(self, t)
240 240 game:playSoundNear(self, "talents/thunderstorm")
... ...