CleverRaven/Cataclysm-DDA — pull request #8181 by BevapDin (2014-07-08 11:40:17+00:00)
Title: Add support for non-interrupting ambient sound

Fixes #7130

The function `game::sound` gets another parameter: `ambient`. Player activities are not canceled when that parameter has the value true. The default (because the parameter is optional) is false. The effect of existing calls to that function is therefor not changed.

Current state is: cancel activity if sound is not from the same locations as the the player and the player can not see the location of the sound source. This means operating on a vehicle works without interruption from the engine when the ~~engine~~ vehicle origin point is visible. The sound comes from the origin point of the vehicle, that point must be visible (it's the point initially selected in the vehicle screen).

Because the line `g->sound(..., true)` does not really tell what that `true` means, there is function `game::ambient_sound` which simply forwards its parameters to `game::sound` and sets `ambient` to true.

Sounds that are changed to be ambient:
- vehicle engines (normal)
- vehicle radio
- radio from iuse (radio function)
- noise emitter (iuse)
- combatsaw
- chainsaw
- chainsaw lajatang
- electric carver
- electric hedge trimmer
- circular saw
- shishkebab
- No. 9
- talking doll

You normally don't want to interrupt pulping corpses because you heard the noisemaker some squares away. Most sounds that are emitted by active items are therefor ambient sounds. Those items can only be activated by the player, their sound should not surprise the player.

Sounds that are not changed, but might be (for discussion):
- sound from firing vehicle turret
- traps triggered by moving vehicle
- moving vehicle smashing stuff on the map
- sound of a fungus releasing spores
- other monster generated sounds (see monattack)
- sounds in iuse.cpp, from items. I did not change sound that are the result of a direct action of the player (e.g. the airhorn, it can only be activated when the player is currently not in an activity).
- explosions?