CleverRaven/Cataclysm-DDA — pull request #7570 by BevapDin (2014-05-07 09:08:25+00:00)
Title: Add known traps & search for traps when waiting

Link to related discussion #7514

This automatically creates a copy of trap objects that might became invisible to the PC. The copy has the visibility set to -1 (always visible) and its id is made from the original id plus the prefix "known_" (e.g. "known_beartrap"). That is the only difference, the copy is automatically created and *not* loaded from json.

Those traps are used instead of the original ones when the player places an otherwise invisible trap, e.g. perception 4, placing a buried bear trap - that would create an invisible trap, that the player knows is there.

When waiting a turn, the PC searches the surroundings for traps, and if possible make them into the a "known_" one so they stay visible. In any case it will inform the user about the found trap ("You found a bear trap to the north!").

I'll leave this (fully working) implementation here so it can be discussed.

This implementation has some shortcomings:
- npc/monsters will see the traps too. But npcs and monsters don't look for traps as of now, so it does not change.
- all players on a map will share knowledge about traps. For single player this might be fine.

KA101 mentioned a trap detection with an item (like a stick). I can change the code if this is requested to
- make the automatic trap search only happen if the player has a suitable item in their inventory (e.g. a stick). Without those items, just pause and do not search.
- make the search a function of the stick (and probably other items?).

Destroying/deactivating traps from afar: this should be handled by disarming traps.

But there is the issue with triggering a trap on purpose from far away by throwing stones. Is this still requested (I can't find an issue about it)?