TheDarklingWolf/Cataclysm-DDA — pull request #856 by indigochill (2013-05-05 15:38:26+00:00)
Title: Roof cave-ins drop rubble piles which deal damage to any PC/NPC/monster hit by them

Cave-ins will now spawn rubble piles of 3 random densities. There is a 50% chance of any given tile within a 3x3 grid centered around the caving in tile spawning a pile of rubble (no relation to the rubble terrain). Rubble will not spawn on terrain marked with noitem. A PC or NPC hit by a pile of rubble should take 10 damage to all body parts. A monster hit by a pile of rubble should take 10 damage. Vehicles currently do not take any damage from piles of rubble. Rubble fields block vision but do not impede movement.

At this point, this is a basically functional (and as far as I've tested, stable) implementation of this enhancement request: https://github.com/TheDarklingWolf/Cataclysm-DDA/issues/172

It could still be improved on in several ways. For instance...

1. Vehicles should take damage.
2. If an NPC is killed by a cave-in caused by the player, the player should get the appropriate consequences for killing the NPC.
3. Damage infliction should be more sophisticated across the board. Perhaps effects like knockdown should be implemented in some situations as well.
4. Player effects inflicted by a cave-in should be integrated with the disease system for more modular handling of effects (like getting stunned)
5. A rubble field should impede movement, and the degree to which it does this should be dependent on its density.
6. Perhaps the smaller two rubble field densities should not block sight.
7. Perhaps rubble fields should decay and spawn smoke fields
8. Perhaps rubble field spawning could be more sophisticated (for instance, right now a rubble pile can spawn on top of a current one and overwrite its density with a new one)