Commit 90e07a0fffcd8f097fc6b3b19aa67001b9818e71

Authored by yutio888
1 parent 3a06daa0

reduce loud sounds: if the same sound played around a single actor more than 2 t…

…imes in a single turn, further sounds will be played in a reduce volume.pl
... ... @@ -2940,6 +2940,12 @@ function _M:playSoundNear(who, name)
2940 2940 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
2941 2941 local pos = {x=0,y=0,z=0}
2942 2942 if self.player and self.player.x then pos.x, pos.y = who.x - self.player.x, who.y - self.player.y end
  2943 + if who.turn_procs and type(name) == "string" then
  2944 + who.turn_procs.sounds = who.turn_procs.sounds or {}
  2945 + who.turn_procs.sounds[name] = (who.turn_procs.sounds[name] or 0) + 1
  2946 + local time = who.turn_procs.sounds[name]
  2947 + name = { name, vol = math.min(1, 1 / (2^ (time - 2))) }
  2948 + end
2943 2949 self:playSound(name, pos)
2944 2950 end
2945 2951 end
... ...