JSON'ing item spawns/drops

Okay, so first let me explain my poor understanding of how item spawns/drops work:

  • There’s a list of “locations” or maybe “item classes”, like living room, bedroom, fridge, science etc. These contain several items.
  • Monsters can define several of the “locations” as their drops with probabilities when they die. One class will be picked randomly, and from the class one item will be picked randomly.
  • Likewise, the map generator uses these locations to determine what items can spawn on a tile, or what items can spawn in a container(like a fridge)

To JSONify this stuff, first we need to JSONify the locations. After that, we might be able to JSONify the monster drops.

One thing confusing me is that there’s already a data/raw/item_groups.json. The only difference between these and locations seems to be that they can also define a chance for each item. Was this code meant to replace mapitemsdef.cpp?

Yes, I think item_groups.json is the stub that’s supposed to replace mapitemsdef.cpp, but it hasn’t been finished.

Pretty much this. GlyphGryph got started on it, but didn’t have time to finish before needing to work on the kickstarter and other things.

Okay, I might work on finishing that then.

Made some progress. https://github.com/CleverRaven/Cataclysm-DDA/issues/1776

On a related note, I’ve noticed http://smf.cataclysmdda.com/index.php?topic=1915.msg23856#msg23856 and it seems completely different from the current implementation.