New function: playSoundsAtEntityInRandomSequence()

This commit was changed on: 6/4/14

This function is required to play the lava hole's sounds because its sounds are meant to be played in a random sequence and are therefore not associated with animation frames, so the animation code can't play these sounds.

I think the durations of the pauses between these sounds should be different and randomly determined because I don't think this sound sequence sounds good otherwise especially when there's multiple lava holes.

Change list
-----------
1. dialogs/menu.lua:
< -White space.

2. app.lua:
a) *SAVEGAME_VERSION = 82 -> 84: Required in this commit because a new afterLoad() sound playing function has been added. 83 has been used in an open pull request.
b) *Added afterLoad() call to world:playLoadedEntitySounds()

3. audio.lua:
a) -White space.
b) +self.entities_waiting_for_sound_to_be_enabled{}: Required to support the resumption of sounds being played by the new play function.
c) +playSoundsAtEntityInRandomSequence()
d) +playSoundAtEntityInRandomSequenceRecursionHandler()
e) +getRandomSilenceLengths(): Required to randomly the determine the durations of the pauses used by the new play function.
f) *Modified playSound(): Moved its sound caching statements into a new function to prevent them from having to be duplicated in the new play function.
g) +canSoundsBePlayed(): Required to support the resumption of sounds being played by the new play function.
h) +onEndPause(paused): Required to support the resumption of sounds being played by the new play function.
i) +tellInterestedEntitiesTheyCanNowPlaySounds(): Required to support the resumption of sounds being played by the new play function.
j) +calls to tellInterestedEntitiesTheyCanNowPlaySounds()
k) +entityNoLongerWaitingForSoundsToBeTurnedOn(entity): Required to prevent the resumption of sounds being played for an entity which no longer exists or no longer wants its sounds to be resumed.

4. entity.lua:
a) +Instance variables for the new play function.
b) +playSoundsAtEntityInRandomSequence()
c) +playAfterLoadSound(): Required to support the resumption of sounds being played by the new play function.
d) +setWaitingForSoundEffectsToBeTurnedOn(state): Required to prevent the resumption of sounds being played for an entity which was playing sounds with the new play function.

5. game_ui.lua:
a) *modified togglePlaySounds(): So that the keyboard shortcut will have the same response as clicking the menu option, allowing it to disable and enable sounds being played by the new play function.

6. world.lua:
a) +Call to audio:onEndPause(): Required to support the resumption of sounds being played by the new play function.
b) +isPaused(): Required to support the resumption of sounds being played by the new play function.
c) *modified afterLoad(): Required to support the resumption of sounds being played by the new play function.
d) +playLoadedEntitySounds(): Required to support the resumption of sounds being played by the new play function.
Created world.lua "can object spawn at" check functions

Because lava holes are objects which spawn instead of being
placed this commit must implement the object spawn checking
function: world:wouldNonSideObjectBreakPathfindingIfSpawnedAt()

This new function performs the required spawn checks by calling
four new functions for each test which allow these tests to also
be called in setBluePrintCell() when objects are being placed:
+ world:areFootprintTilesCoardinatesInvalid()
+ world:willObjectsFootprintTileBeWithinItsAllowedRoomIfLocatedAt()
+ world:checkFootprintCellsTileIsBuildableOrPassable()
+ world:wouldNonSideObjectBreakPathfindingIfSpawnedAt()

So this commit must also modify UIPlaceObjects:setBluePrintCell() by moving the
code for these tests into the new test functions.
Implemented Hell Deaths

1. New files:
a) /objects/gates_to_hell.lua
b) /entities/grimreaper.lua

2. app.lua:
Modified afterLoad(): So that the gates_to_hell object will be added to a world's objects list when its from an old saved game.

3. die.lua:
a) Modified action_die_start(): So that males can either go to heaven or hell.
Heaven deaths are less likely because females can only have them and hell deaths won't happen for males unless there's enough space.
b) +action_die_tick_reaper: Makes hell deaths happen.

4. humanoid.lua:
a) +rise_hell patient animation.
b) Modified Humanoid_startAction(): So that grim reapers with no actions will have the idle action be their default action.

5. patient.lua:
Modified afterLoad(): So that patients from saved games older than 84 will be given the new rise_hell animation.

6. world.lua:
a) +newObjectType(): I've created this function so that app.lua can use it to add the new gates_to_hell object to old worlds.
b) +checkHellDeathSpawnPoints(): Returns true if there's enough space for a hell death to take place using the spawn points provided as parameters.
c) +lavaHoleUseTileUsable():I put this algorithm into its own function to prevent it from having to be duplicated in checkHellDeathSpawnPoints().
d) +spawnGrimReaperAndLavaHole()
e) Modified objectPlaced(): I added statements which are required to respond to the spawning of lava holes (gates_to_hell object).