CleverRaven/Cataclysm-DDA — pull request #7234 by BevapDin (2014-04-14 21:40:09+00:00)
Title: Improve item spawn system, Documentation, Monster drops

This PR extends the new item group system:

- Removes the `mdeath::zombie` function. That function was used to generate zombie clothing and the cash card. This is now done with json.

- Death drops of monsters are now defined either by "monitems" or by an item group named `_death_drops`. I'm not sure if this is good or not (any opinions?).
If you create the new monster "mon_clown", you only have to add an item group with the id "mon_clown_death_drops" and upon the death of a clown, it will spawn items from that group. The new item groups support spawning multiple items at once. If you want your clown monster to spawn clown shoes and a clone suit and sometimes a compressed air horn, use this as item group (no entry of type "monitems" is needed):
```
{
"type": "item_group",
"id": "mon_clown_death_drops",
"subtype": "collection",
"items": [
["clown_suit", 100],
["clownshoes", 100],
["airhorn", 40]
]
}
```

- Fixes #3738. I removed the `game::monitems` vector (and in turn the monitemsdef.cpp file). The json object of type "monitems" is still supported but differently: it creates the `_death_drops` item groups for the listed monster by parsing the json object like a "item_group" object. So instead of a "mon_clown_death_drops" group you can write this as "monitems" entry:
```
{
"type": "monitems",
"id": [ "mon_clown" ],
"subtype": "collection",
"//": "^^ the default subtype is distribution which spawns only one item",
"items": [
["clown_suit", 100],
["clownshoes", 100],
["airhorn", 40]
]
},
```

- This style is more useful if many monster share the same death drops, as they can all be listed in the ids field instead of making separate entries. Note that the "monitems" entry is parsed *exactly* like an "item_group" entry.

- The old "monitems" based calculation of how many items should be spawned is gone. The item group based calculation is different, but it won't create an infinite loop and that's the fix for #3738. Multiple items can be spawned by giving entries in the item group with a count member `"entries": [ { "item": "bag", "count": 10 } ]` or by adding the same item several times to a collection. As each item in a collection is chosen independently, if the group contains the item "a" with probability 50, and item "a" (again) with probability 25, it will create either 0 items (37.5%), 1 item "a" (50%) or 2 items "a" (12.5%).

- Exported the items spawned by the map specials military and drugdealer. Only one set of clothing is spawned for each corpse.

- I don't known which knife the "mon_shia" should spawn, but this is an example of how it could be done:
```
{
"type": "monitems",
"id": "mon_shia",
"items": [ [ "knife_steak", 100 ] ]
}
```
- Or with clothes (in case he isn't naked?) - note that the type must be collection otherwise only one of the group items gets spawned (note that "default_zombie_clothes" spawns several items itself). One can also give the "default_zombie_clothes" entry the probability 50, which would make him naked half the time (-:
```
{
"type": "monitems",
"id": "mon_shia",
"type": "collection",
"groups": [ [ "default_zombie_clothes", 100 ] ],
"items": [ [ "knife_steak", 100 ] ]
}
```

Another example:
```
{
"type": "monitems",
"id": "mon_eyebot",
"groups": [
[ "robots", 4 ],
[ "eyebot", 1 ]
]
},
```
This spawns an item from the group "robots" with a probability of 4/5 or an item of the group "eyebot" with a probability of 1/5 (default subtype is distribution).

It also fixes #6907, as the function mentioned there is removed.

One last question: is the documentation sufficient, or what's missing? I think the documentation (assuming it is good enough) would also fix #5843. This documentation stuff is always a big hassle for me, so I want to get this right.